import - BankAccountDeviceLink for set device to a bank_account/changes in stakeholders & pos
This commit is contained in:
@@ -42,8 +42,14 @@ def get_all_org_type_child(org_type: OrganizationType = None) -> typing.Any:
|
||||
return descendants
|
||||
|
||||
|
||||
def get_bank_info(org):
|
||||
bank = org.bank_information.first()
|
||||
def get_bank_info(org, device=None):
|
||||
if device:
|
||||
# get organization bank account that set to a device
|
||||
bank_account_device_links = org.bank_account_device_links.filter(device=device)
|
||||
bank = bank_account_device_links.first().bank_account \
|
||||
if bank_account_device_links.exists() else org.bank_information.first()
|
||||
else:
|
||||
bank = org.bank_information.first()
|
||||
if not bank:
|
||||
return {}
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user