refactor: improve partner type determination logic in account payment based on account type and payment direction

This commit is contained in:
Suherdy Yacob 2026-04-08 11:43:07 +07:00
parent 2cde9d3c45
commit 4c445c74f3
5 changed files with 6 additions and 3 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -165,12 +165,15 @@ class AccountPayment(models.Model):
))
if counterpart_lines:
if counterpart_lines[0].account_id.account_type == 'asset_receivable':
account_type = counterpart_lines[0].account_id.account_type
if account_type == 'asset_receivable':
partner_type = 'customer'
else:
elif account_type == 'liability_payable':
partner_type = 'supplier'
else:
partner_type = 'customer' if pay.payment_type == 'inbound' else 'supplier'
else:
partner_type = 'customer'
partner_type = 'customer' if pay.payment_type == 'inbound' else 'supplier'
liquidity_amount = sum(liquidity_lines.mapped('amount_currency')) if len(liquidity_lines) > 1 else liquidity_lines.amount_currency