From 320d5c9724913c1a8b834456745af6e397398893 Mon Sep 17 00:00:00 2001 From: vishakhdesai Date: Wed, 18 Dec 2024 17:29:55 +0530 Subject: [PATCH] fix: Paid + Write Off Amount issue in Sales Invoice (cherry picked from commit 1fd7ba7c8879828526dedcce956b6bd59f10a4a9) --- erpnext/accounts/doctype/sales_invoice/sales_invoice.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py index 1a7ffc3c339b..dc2b44e7527a 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py @@ -1002,9 +1002,9 @@ def validate_proj_cust(self): 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) - ): + 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):