refactor: date validation
diff --git a/erpnext/accounts/doctype/bisect_accounting_statements/bisect_accounting_statements.py b/erpnext/accounts/doctype/bisect_accounting_statements/bisect_accounting_statements.py
index bdd1809..e032083 100644
--- a/erpnext/accounts/doctype/bisect_accounting_statements/bisect_accounting_statements.py
+++ b/erpnext/accounts/doctype/bisect_accounting_statements/bisect_accounting_statements.py
@@ -6,6 +6,7 @@
import frappe
from dateutil.relativedelta import relativedelta
+from frappe import _
from frappe.model.document import Document
from frappe.utils import getdate
@@ -57,3 +58,14 @@
print("Periods: ", len(periods))
for x in periods:
print(x)
+
+ def validate(self):
+ self.validate_dates()
+
+ def validate_dates(self):
+ if getdate(self.from_date) > getdate(self.to_date):
+ frappe.throw(
+ _("From Date: {0} cannot be greater than To date: {1}").format(
+ frappe.bold(self.from_date), frappe.bold(self.to_date)
+ )
+ )