[imp] setup new gantt view

bzr revid: nicolas.vanhoren@openerp.com-20120118130652-08nnz3rx1gtk2f3v
This commit is contained in:
niv-openerp 2012-01-18 14:06:52 +01:00
parent 110e826252
commit 4e14e6145d
3 changed files with 33 additions and 7 deletions

View File

@ -1038,6 +1038,12 @@ session.web.View = session.web.Widget.extend(/** @lends session.web.View# */{
template: "EmptyComponent",
// name displayed in view switchers
display_name: '',
init: function(parent, dataset, view_id, options) {
this._super(parent);
this.dataset = dataset;
this.view_id = view_id;
this.set_default_options(options);
},
set_default_options: function(options) {
this.options = options || {};
_.defaults(this.options, {

View File

@ -6,8 +6,20 @@ var _t = openerp.web._t,
_lt = openerp.web._lt;
var QWeb = openerp.web.qweb;
openerp.web.views.add('gantt', 'openerp.web_gantt.GanttView');
openerp.web_gantt.GanttView = openerp.web.View.extend({
display_name: _lt('Gantt'),
template: "GanttView",
start: function() {
return this.rpc("/web/view/load", {"model": this.dataset.model, "view_id": this.view_id, "view_type": "gantt"}, this.on_loaded);
},
on_loaded: function(data) {
this.fields_view = data;
},
});
openerp.web_gantt.GanttViewOld = openerp.web.View.extend({
display_name: _lt('Gantt'),
init: function(parent, dataset, view_id) {
this._super(parent);
@ -52,7 +64,7 @@ openerp.web_gantt.GanttView = openerp.web.View.extend({
return;
}
this.$element.html(QWeb.render("GanttView", {'height': $('.oe-application-container').height(), 'width': $('.oe-application-container').width()}));
this.$element.html(QWeb.render("GanttViewOld", {'height': $('.oe-application-container').height(), 'width': $('.oe-application-container').width()}));
this.has_been_loaded.resolve();
},

View File

@ -1,6 +1,14 @@
<template>
<t t-name="GanttView">
<button class="oe_button" id="add_task">Create</button>
<div t-att-style="'width:'+ width + 'px; height:' + height + 'px; padding-top:6px;position:relative;'" id="GanttView"/>
</t>
</template>
<?xml version="1.0" encoding="UTF-8"?>
<templates>
<t t-name="GanttView">
<div>
<button class="oe_button oe-gantt-view-create">Create</button>
<div class="oe-gantt-view-view"/>
</div>
</t>
<t t-name="GanttViewOld">
<button class="oe_button" id="add_task">Create</button>
<div t-att-style="'width:'+ width + 'px; height:' + height + 'px; padding-top:6px;position:relative;'" id="GanttView"/>
</t>
</templates>