diff --git a/erpnext/accounts/doctype/payment_schedule/payment_schedule.py b/erpnext/accounts/doctype/payment_schedule/payment_schedule.py index 8a292fd3aba2..d61eeb89f0af 100644 --- a/erpnext/accounts/doctype/payment_schedule/payment_schedule.py +++ b/erpnext/accounts/doctype/payment_schedule/payment_schedule.py @@ -32,4 +32,5 @@ class PaymentSchedule(Document): payment_term: DF.Link | None # end: auto-generated types - pass + def validate_discount_date(self): + self.validate_from_to_dates("due_date", "discount_date") diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py index 40c410eed05c..b5481291c0fb 100644 --- a/erpnext/controllers/accounts_controller.py +++ b/erpnext/controllers/accounts_controller.py @@ -2361,6 +2361,7 @@ def validate_payment_schedule_dates(self): return for d in self.get("payment_schedule"): + d.validate_discount_date() if self.doctype == "Sales Order" and getdate(d.due_date) < getdate(self.transaction_date): frappe.throw( _("Row {0}: Due Date in the Payment Terms table cannot be before Posting Date").format(