fix: Auto repeat date validations
diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py
index 1849e8b..dc42a89 100644
--- a/erpnext/controllers/accounts_controller.py
+++ b/erpnext/controllers/accounts_controller.py
@@ -239,6 +239,10 @@
else:
item.set(field_map.get(self.doctype), default_deferred_account)
+ def validate_auto_repeat_subscription_dates(self):
+ if getdate(self.from_date) > getdate(self.to_date):
+ frappe.throw(_("To Date cannot be before From Date"), title=_("Invalid Auto Repeat Date"))
+
def validate_deferred_start_and_end_date(self):
for d in self.items:
if d.get("enable_deferred_revenue") or d.get("enable_deferred_expense"):
diff --git a/erpnext/controllers/buying_controller.py b/erpnext/controllers/buying_controller.py
index 48fe7cb..0514604 100644
--- a/erpnext/controllers/buying_controller.py
+++ b/erpnext/controllers/buying_controller.py
@@ -41,6 +41,7 @@
self.validate_from_warehouse()
self.set_supplier_address()
self.validate_asset_return()
+ self.validate_auto_repeat_subscription_dates()
if self.doctype == "Purchase Invoice":
self.validate_purchase_receipt_if_update_stock()
diff --git a/erpnext/controllers/selling_controller.py b/erpnext/controllers/selling_controller.py
index e8e9076..f427680 100644
--- a/erpnext/controllers/selling_controller.py
+++ b/erpnext/controllers/selling_controller.py
@@ -40,6 +40,7 @@
self.set_customer_address()
self.validate_for_duplicate_items()
self.validate_target_warehouse()
+ self.validate_auto_repeat_subscription_dates()
def set_missing_values(self, for_validate=False):