From a9c2e07c7366a77b977cbebd290fb31fc637022d Mon Sep 17 00:00:00 2001 From: "Vaibhav (OpenERP)" Date: Tue, 4 Oct 2011 15:10:09 +0530 Subject: [PATCH 1/2] [FIX] Removed exception of events manipulation fields to compute calendar scheduler. lp bug: https://launchpad.net/bugs/865945 fixed bzr revid: vda@tinyerp.com-20111004094009-u1vkb6s0u90629rz --- addons/web_calendar/static/src/js/calendar.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/addons/web_calendar/static/src/js/calendar.js b/addons/web_calendar/static/src/js/calendar.js index 5de601e0921..9af5130a121 100644 --- a/addons/web_calendar/static/src/js/calendar.js +++ b/addons/web_calendar/static/src/js/calendar.js @@ -31,7 +31,7 @@ openerp.web_calendar.CalendarView = openerp.web.View.extend({ }, start: function() { this._super(); - this.rpc("/web/view/load", {"model": this.model, "view_id": this.view_id, "view_type":"calendar", 'toolbar': true}, this.on_loaded); + return this.rpc("/web/view/load", {"model": this.model, "view_id": this.view_id, "view_type":"calendar", 'toolbar': true}, this.on_loaded); }, stop: function() { scheduler.clearAll(); @@ -55,6 +55,10 @@ openerp.web_calendar.CalendarView = openerp.web.View.extend({ this.day_length = this.fields_view.arch.attrs.day_length || 8; this.color_field = this.fields_view.arch.attrs.color; this.fields = this.fields_view.fields; + + if (!this.date_start) { + throw new Error("Calendar view has none of the following attributes : 'date_start'"); + } //* Calendar Fields * this.calendar_fields.date_start = {'name': this.date_start, 'kind': this.fields[this.date_start].type}; @@ -68,9 +72,6 @@ openerp.web_calendar.CalendarView = openerp.web.View.extend({ if (this.date_stop) { this.calendar_fields.date_stop = {'name': this.date_stop, 'kind': this.fields[this.date_stop].type}; } - if (!this.date_delay && !this.date_stop) { - throw new Error("Calendar view has none of the following attributes : 'date_stop', 'date_delay'"); - } for (var fld = 0; fld < this.fields_view.arch.children.length; fld++) { this.info_fields.push(this.fields_view.arch.children[fld].attrs.name); @@ -200,7 +201,7 @@ openerp.web_calendar.CalendarView = openerp.web.View.extend({ convert_event: function(evt) { var date_start = openerp.web.str_to_datetime(evt[this.date_start]), date_stop = this.date_stop ? openerp.web.str_to_datetime(evt[this.date_stop]) : null, - date_delay = evt[this.date_delay] || null, + date_delay = evt[this.date_delay] || 1.0, res_text = '', res_description = []; From cb05cf6ce2a2c14b635701c62d0972dcd7a56ff8 Mon Sep 17 00:00:00 2001 From: "Vaibhav (OpenERP)" Date: Tue, 4 Oct 2011 19:07:53 +0530 Subject: [PATCH 2/2] [FIX] exception error message. bzr revid: vda@tinyerp.com-20111004133753-kptuu127azazrmg6 --- addons/web_calendar/static/src/js/calendar.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/web_calendar/static/src/js/calendar.js b/addons/web_calendar/static/src/js/calendar.js index 9af5130a121..ce200fe4f5f 100644 --- a/addons/web_calendar/static/src/js/calendar.js +++ b/addons/web_calendar/static/src/js/calendar.js @@ -57,7 +57,7 @@ openerp.web_calendar.CalendarView = openerp.web.View.extend({ this.fields = this.fields_view.fields; if (!this.date_start) { - throw new Error("Calendar view has none of the following attributes : 'date_start'"); + throw new Error("Calendar view has not defined 'date_start' attribute."); } //* Calendar Fields *