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):
|
def allocate_outstanding_based_on_payment_terms(self, row):
|
||||||
self.get_payment_terms(row)
|
self.get_payment_terms(row)
|
||||||
for term in row.payment_terms:
|
for term in row.payment_terms:
|
||||||
|
# update "paid" and "outstanding" for this term
|
||||||
# update "paid" and "oustanding" for this term
|
|
||||||
if not term.paid:
|
if not term.paid:
|
||||||
self.allocate_closing_to_term(row, 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:
|
if term.outstanding:
|
||||||
self.allocate_closing_to_term(row, term, "credit_note")
|
self.allocate_closing_to_term(row, term, "credit_note")
|
||||||
|
|
||||||
@ -453,7 +452,8 @@ class ReceivablePayableReport(object):
|
|||||||
"""
|
"""
|
||||||
select
|
select
|
||||||
si.name, si.party_account_currency, si.currency, si.conversion_rate,
|
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
|
from `tab{0}` si, `tabPayment Schedule` ps
|
||||||
where
|
where
|
||||||
si.name = ps.parent and
|
si.name = ps.parent and
|
||||||
@ -469,6 +469,10 @@ class ReceivablePayableReport(object):
|
|||||||
original_row = frappe._dict(row)
|
original_row = frappe._dict(row)
|
||||||
row.payment_terms = []
|
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 no or single payment terms, no need to split the row
|
||||||
if len(payment_terms_details) <= 1:
|
if len(payment_terms_details) <= 1:
|
||||||
return
|
return
|
||||||
@ -483,7 +487,7 @@ class ReceivablePayableReport(object):
|
|||||||
) and d.currency == d.party_account_currency:
|
) and d.currency == d.party_account_currency:
|
||||||
invoiced = d.payment_amount
|
invoiced = d.payment_amount
|
||||||
else:
|
else:
|
||||||
invoiced = flt(flt(d.payment_amount) * flt(d.conversion_rate), self.currency_precision)
|
invoiced = d.base_payment_amount
|
||||||
|
|
||||||
row.payment_terms.append(
|
row.payment_terms.append(
|
||||||
term.update(
|
term.update(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user