fix: AR/AP report based on payment terms (#36574)
* fix: AR/AP report based on payment terms * fix: AR/AP report based on payment terms
This commit is contained in:
parent
39ec11200e
commit
fbb5058531
@ -436,12 +436,11 @@ class ReceivablePayableReport(object):
|
||||
def allocate_outstanding_based_on_payment_terms(self, row):
|
||||
self.get_payment_terms(row)
|
||||
for term in row.payment_terms:
|
||||
|
||||
# update "paid" and "oustanding" for this term
|
||||
# update "paid" and "outstanding" for this term
|
||||
if not term.paid:
|
||||
self.allocate_closing_to_term(row, term, "paid")
|
||||
|
||||
# update "credit_note" and "oustanding" for this term
|
||||
# update "credit_note" and "outstanding" for this term
|
||||
if term.outstanding:
|
||||
self.allocate_closing_to_term(row, term, "credit_note")
|
||||
|
||||
@ -453,7 +452,8 @@ class ReceivablePayableReport(object):
|
||||
"""
|
||||
select
|
||||
si.name, si.party_account_currency, si.currency, si.conversion_rate,
|
||||
ps.due_date, ps.payment_term, ps.payment_amount, ps.description, ps.paid_amount, ps.discounted_amount
|
||||
si.total_advance, ps.due_date, ps.payment_term, ps.payment_amount, ps.base_payment_amount,
|
||||
ps.description, ps.paid_amount, ps.discounted_amount
|
||||
from `tab{0}` si, `tabPayment Schedule` ps
|
||||
where
|
||||
si.name = ps.parent and
|
||||
@ -469,6 +469,10 @@ class ReceivablePayableReport(object):
|
||||
original_row = frappe._dict(row)
|
||||
row.payment_terms = []
|
||||
|
||||
# Advance allocated during invoicing is not considered in payment terms
|
||||
# Deduct that from paid amount pre allocation
|
||||
row.paid -= flt(payment_terms_details[0].total_advance)
|
||||
|
||||
# If no or single payment terms, no need to split the row
|
||||
if len(payment_terms_details) <= 1:
|
||||
return
|
||||
@ -483,7 +487,7 @@ class ReceivablePayableReport(object):
|
||||
) and d.currency == d.party_account_currency:
|
||||
invoiced = d.payment_amount
|
||||
else:
|
||||
invoiced = flt(flt(d.payment_amount) * flt(d.conversion_rate), self.currency_precision)
|
||||
invoiced = d.base_payment_amount
|
||||
|
||||
row.payment_terms.append(
|
||||
term.update(
|
||||
|
Loading…
x
Reference in New Issue
Block a user