Payment schedule total amount validation considering write off amount
diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py
index a27a21b..c55f7d6 100644
--- a/erpnext/controllers/accounts_controller.py
+++ b/erpnext/controllers/accounts_controller.py
@@ -695,6 +695,8 @@
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"))