Merge pull request #5248 from saurabh6790/hotfix
[fixes] raise exception on deletion of fiscal year if fiscal year is set as Default
This commit is contained in:
commit
b5e700f3af
@ -40,6 +40,11 @@ class FiscalYear(Document):
|
|||||||
|
|
||||||
def on_update(self):
|
def on_update(self):
|
||||||
check_duplicate_fiscal_year(self)
|
check_duplicate_fiscal_year(self)
|
||||||
|
|
||||||
|
def on_trash(self):
|
||||||
|
global_defaults = frappe.get_doc("Global Defaults")
|
||||||
|
if global_defaults.current_fiscal_year == self.name:
|
||||||
|
frappe.throw(_("You cannot delete Fiscal Year {0}. Fiscal Year {0} is set as default in Global Settings").format(self.name))
|
||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def check_duplicate_fiscal_year(doc):
|
def check_duplicate_fiscal_year(doc):
|
||||||
|
@ -206,3 +206,5 @@ def get_month_details(year, month):
|
|||||||
'month_end_date': med,
|
'month_end_date': med,
|
||||||
'month_days': month_days
|
'month_days': month_days
|
||||||
})
|
})
|
||||||
|
else:
|
||||||
|
frappe.throw(_("Fiscal Year {0} not found").format(year))
|
Loading…
Reference in New Issue
Block a user