From e591c85f7c080cc749c3516375d84ad120a5fe5c Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 21 Dec 2017 11:46:30 +0530 Subject: [PATCH] Payment schedule total amount validation considering write off amount --- erpnext/controllers/accounts_controller.py | 2 ++ 1 file changed, 2 insertions(+) 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"))