import - BankAccountDeviceLink for set device to a bank_account/changes in stakeholders & pos

This commit is contained in:
2025-12-30 16:57:15 +03:30
parent 9a02ad4622
commit e3318b7e1e
8 changed files with 104 additions and 11 deletions

View File

@@ -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 {