fix: incorrect payment amount in the payment terms if the sales invoice has the advance amount
This commit is contained in:
parent
77bf60e1ac
commit
4a267b9340
@ -787,6 +787,9 @@ class AccountsController(TransactionBase):
|
|||||||
if self.doctype in ("Sales Invoice", "Purchase Invoice"):
|
if self.doctype in ("Sales Invoice", "Purchase Invoice"):
|
||||||
grand_total = grand_total - flt(self.write_off_amount)
|
grand_total = grand_total - flt(self.write_off_amount)
|
||||||
|
|
||||||
|
if self.get("total_advance"):
|
||||||
|
grand_total -= self.get("total_advance")
|
||||||
|
|
||||||
if not self.get("payment_schedule"):
|
if not self.get("payment_schedule"):
|
||||||
if self.get("payment_terms_template"):
|
if self.get("payment_terms_template"):
|
||||||
data = get_payment_terms(self.payment_terms_template, posting_date, grand_total)
|
data = get_payment_terms(self.payment_terms_template, posting_date, grand_total)
|
||||||
@ -832,6 +835,9 @@ class AccountsController(TransactionBase):
|
|||||||
total = flt(total, self.precision("grand_total"))
|
total = flt(total, self.precision("grand_total"))
|
||||||
|
|
||||||
grand_total = flt(self.get("rounded_total") or self.grand_total, self.precision('grand_total'))
|
grand_total = flt(self.get("rounded_total") or self.grand_total, self.precision('grand_total'))
|
||||||
|
if self.get("total_advance"):
|
||||||
|
grand_total -= self.get("total_advance")
|
||||||
|
|
||||||
if self.doctype in ("Sales Invoice", "Purchase Invoice"):
|
if self.doctype in ("Sales Invoice", "Purchase Invoice"):
|
||||||
grand_total = grand_total - flt(self.write_off_amount)
|
grand_total = grand_total - flt(self.write_off_amount)
|
||||||
if total != grand_total:
|
if total != grand_total:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user