fix: respect user set account if not advance account for getting outstanding invoices in payment entry
(cherry picked from commit 9faf78d3e5)
This commit is contained in:
@@ -1798,7 +1798,7 @@ class PaymentEntry(AccountsController):
|
||||
paid_amount -= sum(flt(d.amount, precision) for d in self.deductions)
|
||||
|
||||
for ref in self.references:
|
||||
reference_outstanding_amount = ref.outstanding_amount
|
||||
reference_outstanding_amount = flt(ref.outstanding_amount)
|
||||
abs_outstanding_amount = abs(reference_outstanding_amount)
|
||||
|
||||
if reference_outstanding_amount > 0:
|
||||
@@ -2243,10 +2243,17 @@ def get_outstanding_reference_documents(args, validate=False):
|
||||
outstanding_invoices = []
|
||||
negative_outstanding_invoices = []
|
||||
|
||||
party_account = args.get("party_account")
|
||||
|
||||
# get party account if advance account is set.
|
||||
if args.get("book_advance_payments_in_separate_party_account"):
|
||||
party_account = get_party_account(args.get("party_type"), args.get("party"), args.get("company"))
|
||||
else:
|
||||
party_account = args.get("party_account")
|
||||
accounts = get_party_account(
|
||||
args.get("party_type"), args.get("party"), args.get("company"), include_advance=True
|
||||
)
|
||||
advnace_account = accounts[1] if len(accounts) >= 1 else None
|
||||
|
||||
if party_account == advnace_account:
|
||||
party_account = accounts[0]
|
||||
|
||||
if args.get("get_outstanding_invoices"):
|
||||
outstanding_invoices = get_outstanding_invoices(
|
||||
|
||||
Reference in New Issue
Block a user