Merge pull request #33143 from deepeshgarg007/auto_repeat_dates

fix: Auto repeat date validations
This commit is contained in:
Deepesh Garg 2022-11-29 09:28:19 +05:30 committed by GitHub
commit 8287fb5104
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 0 deletions

View File

@ -239,6 +239,14 @@ class AccountsController(TransactionBase):
else:
item.set(field_map.get(self.doctype), default_deferred_account)
def validate_auto_repeat_subscription_dates(self):
if (
self.get("from_date")
and self.get("to_date")
and 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"):

View File

@ -41,6 +41,7 @@ class BuyingController(SubcontractingController):
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()

View File

@ -40,6 +40,7 @@ class SellingController(StockController):
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):