fix - agency distribution show detail on pos device - v1
This commit is contained in:
@@ -80,13 +80,15 @@ def pos_organizations_sharing_information(
|
|||||||
|
|
||||||
# if device owner is an agency organization
|
# if device owner is an agency organization
|
||||||
if owner_org.type.key == 'AGC':
|
if owner_org.type.key == 'AGC':
|
||||||
sharing_information_list = agency_organization_pos_info(
|
sharing_information_list_agency = agency_organization_pos_info(
|
||||||
agency=owner_org,
|
agency=owner_org,
|
||||||
pos_sharing_list=sharing_information_list,
|
pos_sharing_list=sharing_information_list,
|
||||||
device=device,
|
device=device,
|
||||||
distribution=distribution,
|
distribution=distribution,
|
||||||
quota_stat=quota_stat
|
quota_stat=quota_stat
|
||||||
)
|
)
|
||||||
|
if sharing_information_list_agency:
|
||||||
|
return sharing_information_list_agency
|
||||||
|
|
||||||
return sharing_information_list
|
return sharing_information_list
|
||||||
|
|
||||||
@@ -112,26 +114,28 @@ def agency_organization_pos_info(
|
|||||||
org_quota_stat=quota_stat
|
org_quota_stat=quota_stat
|
||||||
) if agc_share_amount.exists() else None
|
) if agc_share_amount.exists() else None
|
||||||
|
|
||||||
agc_share_amount = agc_share_amount.first().share_amount if agc_share_amount.exists() else None
|
agc_share_amount = agc_share_amount.first().share_amount if agc_share_amount else None
|
||||||
|
|
||||||
# calculate agency parent share amount
|
if agc_share_amount:
|
||||||
agc_parent_amount = next((item for item in pos_sharing_list if item.get('default_account')), None)
|
# calculate agency parent share amount
|
||||||
if agc_parent_amount and agc_share_amount:
|
agc_parent_amount = next((item for item in pos_sharing_list if item.get('default_account')), None)
|
||||||
agc_parent_amount['amount'] = agc_parent_amount['amount'] - agc_share_amount
|
if agc_parent_amount and agc_share_amount:
|
||||||
|
agc_parent_amount['amount'] = agc_parent_amount['amount'] - agc_share_amount
|
||||||
|
|
||||||
pos_sharing_list.append({
|
pos_sharing_list.append({
|
||||||
"organization_name": agency.name,
|
"organization_name": agency.name,
|
||||||
"bank_account": {
|
"bank_account": {
|
||||||
"credit_card": agency.bank_information.first().card,
|
"credit_card": agency.bank_information.first().card,
|
||||||
"sheba": "IR" + agency.bank_information.first().sheba,
|
"sheba": "IR" + agency.bank_information.first().sheba,
|
||||||
"account": agency.bank_information.first().account,
|
"account": agency.bank_information.first().account,
|
||||||
} if agency.bank_information.exists() else {},
|
} if agency.bank_information.exists() else {},
|
||||||
"amount": agc_share_amount,
|
"amount": agc_share_amount,
|
||||||
"agency": True,
|
"agency": True,
|
||||||
"default_account": True
|
"default_account": True
|
||||||
})
|
})
|
||||||
|
|
||||||
return pos_sharing_list
|
return pos_sharing_list
|
||||||
|
return None
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user