summaryrefslogtreecommitdiff
path: root/addons/web_gantt/static/src
diff options
context:
space:
mode:
authorniv-openerp <nicolas.vanhoren@openerp.com>2012-01-04 17:16:15 +0100
committerniv-openerp <nicolas.vanhoren@openerp.com>2012-01-04 17:16:15 +0100
commit0a02dc0d87fa6e7f6c81f7ecccbbd33aba87541e (patch)
treebf9db39ac797dcdbc7a515ac9b6da45c2c01663b /addons/web_gantt/static/src
parentda7f6d234f155ca037d6a1421cea24631833645a (diff)
[fix] problem with gantt view, was crashing when no records to show
bzr revid: nicolas.vanhoren@openerp.com-20120104161615-pt0pr28sgb7vkxer
Diffstat (limited to 'addons/web_gantt/static/src')
-rw-r--r--addons/web_gantt/static/src/js/gantt.js14
1 files changed, 6 insertions, 8 deletions
diff --git a/addons/web_gantt/static/src/js/gantt.js b/addons/web_gantt/static/src/js/gantt.js
index 78e877ffd18..2b84f18ac88 100644
--- a/addons/web_gantt/static/src/js/gantt.js
+++ b/addons/web_gantt/static/src/js/gantt.js
@@ -48,7 +48,8 @@ openerp.web_gantt.GanttView = openerp.web.View.extend({
}
if (!this.date_start) {
- return self.do_warn(_t("date_start is not defined "))
+ console.error("date_start is not defined in the definition of this gantt view");
+ return;
}
this.$element.html(QWeb.render("GanttView", {'height': $('.oe-application-container').height(), 'width': $('.oe-application-container').width()}));
@@ -99,17 +100,14 @@ openerp.web_gantt.GanttView = openerp.web.View.extend({
on_project_loaded: function(events) {
if(!events.length) return;
- var self = this,
- started_projects = _.filter(events, function(res) {
- return res[self.date_start];
+ var self = this;
+ var started_projects = _.filter(events, function(res) {
+ return !!res[self.date_start];
});
this.database_projects = started_projects;
- if(!started_projects.length)
- return self.do_warn(_t("date_start is not defined"));
-
- if(!self.name && started_projects.length) {
+ if(!self.name && started_projects.length > 0) {
var name = started_projects[0][self.parent];
self.name = name instanceof Array? name[name.length - 1] : name;
}