fix - change transaction base from distribution to quota stat
This commit is contained in:
@@ -1,15 +1,15 @@
|
||||
from apps.product.models import QuotaUsage, IncentivePlan
|
||||
from apps.livestock.models import LiveStockType
|
||||
from apps.product.models import QuotaUsage, IncentivePlan
|
||||
|
||||
|
||||
class QuotaUsageService:
|
||||
|
||||
@staticmethod
|
||||
def allocate_usage(rancher, distribution, item_data):
|
||||
def allocate_usage(rancher, distribution, item_data, quota_stat=None):
|
||||
""" save & calculate quota usage of rancher """
|
||||
|
||||
# purchase quota usage of rancher
|
||||
if 'livestock_statistic' in item_data.keys():
|
||||
if 'livestock_statistic' in item_data.keys(): # noqa
|
||||
|
||||
# get list of livestock types object for transaction item
|
||||
livestock_types = {
|
||||
@@ -40,6 +40,7 @@ class QuotaUsageService:
|
||||
rancher=rancher,
|
||||
livestock_type=livestock_type,
|
||||
distribution=distribution,
|
||||
quota_stat=quota_stat,
|
||||
incentive_plan=incentive_plans.get(item['id']) if is_incentive else None,
|
||||
defaults={
|
||||
"count": item['count'],
|
||||
|
||||
Reference in New Issue
Block a user