summaryrefslogtreecommitdiff
path: root/addons/web_gantt/static/src/js
diff options
context:
space:
mode:
authorniv-openerp <nicolas.vanhoren@openerp.com>2012-01-25 13:55:49 +0100
committerniv-openerp <nicolas.vanhoren@openerp.com>2012-01-25 13:55:49 +0100
commitd94a035ff80b37b0ee7123e7a245f7d71b2ca4d7 (patch)
treea5cf83dd8f1b73cca011f8c62f69d518e4e2a961 /addons/web_gantt/static/src/js
parent647785331e7aceaab59a6639e53a107f0f08915b (diff)
[imp] added create
bzr revid: nicolas.vanhoren@openerp.com-20120125125549-m3n8ii4rrukuttpl
Diffstat (limited to 'addons/web_gantt/static/src/js')
-rw-r--r--addons/web_gantt/static/src/js/gantt.js17
1 files changed, 16 insertions, 1 deletions
diff --git a/addons/web_gantt/static/src/js/gantt.js b/addons/web_gantt/static/src/js/gantt.js
index a00ea87f0dc..d19138494e3 100644
--- a/addons/web_gantt/static/src/js/gantt.js
+++ b/addons/web_gantt/static/src/js/gantt.js
@@ -16,6 +16,7 @@ openerp.web_gantt.GanttView = openerp.web.View.extend({
this.chart_id = _.uniqueId();
},
start: function() {
+ $(".oe-gantt-view-create", this.$element).click(this.on_task_create);
return $.when(this.rpc("/web/view/load", {"model": this.dataset.model, "view_id": this.view_id, "view_type": "gantt"}),
this.rpc("/web/searchview/fields_get", {"model": this.dataset.model})).pipe(this.on_loaded);
},
@@ -55,7 +56,8 @@ openerp.web_gantt.GanttView = openerp.web.View.extend({
});
},
reload: function() {
- return this.do_search(this.last_domains, this.last_contexts, this.last_group_bys);
+ if (this.last_domains !== undefined)
+ return this.do_search(this.last_domains, this.last_contexts, this.last_group_bys);
},
on_data_loaded: function(tasks, group_bys) {
var self = this;
@@ -206,6 +208,19 @@ openerp.web_gantt.GanttView = openerp.web.View.extend({
{}
);
},
+ on_task_create: function() {
+ var self = this;
+ var pop = new openerp.web.form.SelectCreatePopup(this);
+ pop.on_select_elements.add_last(function() {
+ self.reload();
+ });
+ pop.select_element(
+ self.dataset.model,
+ {
+ initial_view: "form",
+ }
+ );
+ },
});
openerp.web_gantt.GanttViewOld = openerp.web.View.extend({