Changes in dashboard start date and end date default logic such that the

conditions for fiscal year range are met
This commit is contained in:
Anand Doshi 2011-12-12 20:24:06 +05:30
parent 3a23a5740e
commit 130ae98675
2 changed files with 15 additions and 3 deletions

View File

@ -10,8 +10,20 @@ pscript.onload_dashboard = function() {
pscript.dashboard_settings = {
company: sys_defaults.company,
start: dateutil.obj_to_str(dateutil.add_days(new Date(), -180)),
end: dateutil.obj_to_str(new Date()),
start: (function() {
var start_date = dateutil.add_days(new Date(), -180);
var year_start_date = dateutil.str_to_obj(sys_defaults.year_start_date);
if (start_date < year_start_date) { start_date = year_start_date; }
console.log(start_date);
return dateutil.obj_to_str(start_date);
})(),
end: (function() {
var end_date = new Date();
var year_end_date = dateutil.str_to_obj(sys_defaults.year_end_date);
if (end_date > year_end_date) { end_date = year_end_date; }
console.log(end_date);
return dateutil.obj_to_str(end_date);
})(),
interval: 30
}

View File

@ -139,7 +139,7 @@ class DashboardWidget:
return self.glc.get_as_on_balance(acc, fiscal_year, start, debit_or_credit, lft, rgt)
else:
webnotes.msgprint('Please select the START DATE and END DATE such that\
they fall within the <b>same fiscal year</b> as defined in\
they fall within <b>fiscal year(s)</b> as defined in\
Setup > System > Fiscal Year.', raise_exception=1)