validation to check for possible duplicate payment terms

This commit is contained in:
tunde
2017-09-22 23:12:55 +01:00
parent cf42d1db5c
commit 77ecacc379
5 changed files with 53 additions and 1 deletions

View File

@@ -648,12 +648,15 @@ class AccountsController(TransactionBase):
self.validate_payment_schedule_amount()
def validate_payment_schedule_dates(self):
dates = []
if self.due_date and getdate(self.due_date) < getdate(self.posting_date):
frappe.throw(_("Due Date cannot be before posting date"))
for d in self.get("payment_schedule"):
if getdate(d.due_date) < getdate(self.posting_date):
frappe.throw(_("Row {0}: Due Date cannot be before posting date").format(d.idx))
elif d.due_date in dates:
frappe.throw(_("Row {0}: Duplicate due date found").format(d.idx))
def validate_payment_schedule_amount(self):
total = 0