Merge pull request #16507 from rohitwaghchaure/fiscal_year_should_always_be_for_12_months
fix: fiscal year should always be for 12 months
This commit is contained in:
commit
49c1f023b1
@ -35,11 +35,12 @@ class FiscalYear(Document):
|
||||
|
||||
def validate_dates(self):
|
||||
if getdate(self.year_start_date) > getdate(self.year_end_date):
|
||||
frappe.throw(_("Fiscal Year Start Date should not be greater than Fiscal Year End Date"))
|
||||
frappe.throw(_("Fiscal Year Start Date should be one year earlier than Fiscal Year End Date"))
|
||||
|
||||
if (getdate(self.year_end_date) - getdate(self.year_start_date)).days > 366:
|
||||
date = getdate(self.year_start_date) + relativedelta(years=1) - relativedelta(days=1)
|
||||
self.year_end_date = date.strftime("%Y-%m-%d")
|
||||
date = getdate(self.year_start_date) + relativedelta(years=1) - relativedelta(days=1)
|
||||
|
||||
if getdate(self.year_end_date) != date:
|
||||
frappe.throw(_("Fiscal Year End Date should be one year after Fiscal Year Start Date"))
|
||||
|
||||
def on_update(self):
|
||||
check_duplicate_fiscal_year(self)
|
||||
|
Loading…
x
Reference in New Issue
Block a user