Skip to content

Commit

Permalink
fix: Paid + Write Off Amount issue in Sales Invoice
Browse files Browse the repository at this point in the history
  • Loading branch information
vishakhdesai committed Dec 18, 2024
1 parent 54eedae commit daef362
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions erpnext/accounts/doctype/sales_invoice/sales_invoice.py
Original file line number Diff line number Diff line change
Expand Up @@ -1008,12 +1008,11 @@ def validate_proj_cust(self):
throw(_("Customer {0} does not belong to project {1}").format(self.customer, self.project))

def validate_pos(self):
if self.is_return:
invoice_total = self.rounded_total or self.grand_total
if flt(self.paid_amount) + flt(self.write_off_amount) - flt(invoice_total) > 1.0 / (
10.0 ** (self.precision("grand_total") + 1.0)
):
frappe.throw(_("Paid amount + Write Off Amount can not be greater than Grand Total"))
invoice_total = self.rounded_total or self.grand_total
if abs(flt(self.paid_amount)) + abs(flt(self.write_off_amount)) - abs(flt(invoice_total)) > 1.0 / (
10.0 ** (self.precision("grand_total") + 1.0)
):
frappe.throw(_("Paid amount + Write Off Amount can not be greater than Grand Total"))

def validate_warehouse(self):
super().validate_warehouse()
Expand Down

0 comments on commit daef362

Please sign in to comment.