diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py index a27a21ba93..c55f7d65ab 100644 --- a/erpnext/controllers/accounts_controller.py +++ b/erpnext/controllers/accounts_controller.py @@ -695,6 +695,8 @@ class AccountsController(TransactionBase): total = flt(total, self.precision("grand_total")) grand_total = flt(self.get("rounded_total") or self.grand_total, self.precision('grand_total')) + if self.doctype in ("Sales Invoice", "Purchase Invoice"): + grand_total = grand_total - flt(self.write_off_amount) if total != grand_total: frappe.throw(_("Total Payment Amount in Payment Schedule must be equal to Grand / Rounded Total"))