fix: better error messages

This commit is contained in:
Sagar Vora 2019-01-29 13:03:46 +05:30 committed by GitHub
parent a8e743e3c4
commit 9520e345bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -35,12 +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"))
date = getdate(self.year_start_date) + relativedelta(years=1) - relativedelta(days=1)
if getdate(self.year_end_date) != date:
frappe.throw(_("The difference between the year start date and year end date must be 12 months."))
frappe.throw(_("Fiscal Year End Date should be one year after Fiscal Year Start Date"))
def on_update(self):
check_duplicate_fiscal_year(self)