Skip to content

Commit

Permalink
feat: validate discount date in payment schedule
Browse files Browse the repository at this point in the history
  • Loading branch information
barredterra committed Dec 10, 2024
1 parent a7d9642 commit 25697ba
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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")
1 change: 1 addition & 0 deletions erpnext/controllers/accounts_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 25697ba

Please sign in to comment.