[fix] Advance adjustment in invoice cannot be greater than grand total
This commit is contained in:
@@ -397,6 +397,16 @@ class calculate_taxes_and_totals(object):
|
||||
for adv in self.doc.get("advances")])
|
||||
|
||||
self.doc.total_advance = flt(total_allocated_amount, self.doc.precision("total_advance"))
|
||||
|
||||
if self.doc.party_account_currency == self.doc.currency:
|
||||
invoice_total = self.doc.grand_total
|
||||
else:
|
||||
invoice_total = flt(self.doc.grand_total * self.doc.conversion_rate,
|
||||
self.doc.precision("grand_total"))
|
||||
|
||||
if self.doc.total_advance > invoice_total:
|
||||
frappe.throw(_("Advance amount cannot be greater than {0} {1}")
|
||||
.format(self.doc.party_account_currency, invoice_total))
|
||||
|
||||
if self.doc.docstatus == 0:
|
||||
self.calculate_outstanding_amount()
|
||||
|
||||
Reference in New Issue
Block a user