mirror of
https://github.com/frappe/erpnext.git
synced 2026-04-19 23:05:12 +00:00
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)
|
paid_amount -= sum(flt(d.amount, precision) for d in self.deductions)
|
||||||
|
|
||||||
for ref in self.references:
|
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)
|
abs_outstanding_amount = abs(reference_outstanding_amount)
|
||||||
|
|
||||||
if reference_outstanding_amount > 0:
|
if reference_outstanding_amount > 0:
|
||||||
@@ -2243,10 +2243,17 @@ def get_outstanding_reference_documents(args, validate=False):
|
|||||||
outstanding_invoices = []
|
outstanding_invoices = []
|
||||||
negative_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"):
|
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"))
|
accounts = get_party_account(
|
||||||
else:
|
args.get("party_type"), args.get("party"), args.get("company"), include_advance=True
|
||||||
party_account = args.get("party_account")
|
)
|
||||||
|
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"):
|
if args.get("get_outstanding_invoices"):
|
||||||
outstanding_invoices = get_outstanding_invoices(
|
outstanding_invoices = get_outstanding_invoices(
|
||||||
|
|||||||
Reference in New Issue
Block a user