From 1dd3396b60976f6083414c49a448aff7782df1d2 Mon Sep 17 00:00:00 2001 From: Saqib Ansari Date: Mon, 15 Feb 2021 11:44:33 +0530 Subject: [PATCH] fix: condition --- erpnext/accounts/doctype/payment_entry/payment_entry.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry.py b/erpnext/accounts/doctype/payment_entry/payment_entry.py index 8e34087e563..81a0395b8b0 100644 --- a/erpnext/accounts/doctype/payment_entry/payment_entry.py +++ b/erpnext/accounts/doctype/payment_entry/payment_entry.py @@ -1337,7 +1337,7 @@ def apply_early_payment_discount(paid_amount, received_amount, doc): difference_amount = 0 if doc.doctype in ["Sales Invoice", "Purchase Invoice"] and doc.payment_schedule: for term in doc.payment_schedule: - if not term.discounted_amount and term.discount_percentage and getdate(nowdate()) <= term.due_date: + if not term.paid_amount and term.discount_percentage and getdate(nowdate()) <= term.due_date: discount_amount = term.payment_amount * (term.discount_percentage / 100) discount_amount_in_foreign_currency = discount_amount * doc.get('conversion_rate', 1)