[fix] [minor] setup wizard - calculate year end date on change of year start date

This commit is contained in:
Akhilesh Darjee 2013-11-26 17:29:51 +05:30
parent 259208187c
commit 84ed127e72
2 changed files with 10 additions and 3 deletions

View File

@ -24,9 +24,10 @@ class DocType:
year_start_end_dates = webnotes.conn.sql("""select year_start_date, year_end_date
from `tabFiscal Year` where name=%s""", (self.doc.name))
if getdate(self.doc.year_start_date) != year_start_end_dates[0][0] or getdate(self.doc.year_end_date) != year_start_end_dates[0][1]:
webnotes.throw(_("Cannot change Year Start Date and Year End Date \
once the Fiscal Year is saved."))
if year_start_end_dates:
if getdate(self.doc.year_start_date) != year_start_end_dates[0][0] or getdate(self.doc.year_end_date) != year_start_end_dates[0][1]:
webnotes.throw(_("Cannot change Year Start Date and Year End Date \
once the Fiscal Year is saved."))
def on_update(self):
# validate year start date and year end date

View File

@ -102,6 +102,12 @@ wn.pages['setup-wizard'].onload = function(wrapper) {
var abbr = $.map(parts, function(p) { return p ? p.substr(0,1) : null }).join("");
slide.get_input("company_abbr").val(abbr.toUpperCase());
}).val(wn.boot.control_panel.company_name || "").trigger("change");
slide.get_input("fy_start_date").on("change", function() {
var year_end_date =
wn.datetime.add_days(wn.datetime.add_months(slide.get_input("fy_start_date").val(), 12), -1);
slide.get_input("fy_end_date").val(year_end_date);
});
}
},