[imp] mado o2m compatible with graph view

bzr revid: nicolas.vanhoren@openerp.com-20111007162156-10r2h2zws40oabnp
This commit is contained in:
niv-openerp 2011-10-07 18:21:56 +02:00
parent 4d8c486a14
commit e2e01eed83
2 changed files with 16 additions and 7 deletions

View File

@ -1897,6 +1897,8 @@ openerp.web.form.FieldOne2Many = openerp.web.form.Field.extend({
self.save_form_view();
});
controller.$element.find(".oe_form_button_save_edit").hide();
} else if (view_type == "graph") {
self.reload_current_view()
}
self.is_started.resolve();
});
@ -1919,6 +1921,8 @@ openerp.web.form.FieldOne2Many = openerp.web.form.Field.extend({
this.form_last_update.then(function() {
this.form_last_update = view.do_show();
});
} else if (self.viewmanager.active_view === "graph") {
view.do_search(this.build_domain(), this.dataset.get_context(), []);
}
},
set_value: function(value) {

View File

@ -28,6 +28,7 @@ openerp.web_graph.GraphView = openerp.web.View.extend({
this.ordinate = null;
this.columns = [];
this.group_field = null;
this.is_loaded = $.Deferred();
},
do_show: function () {
this.$element.show();
@ -86,6 +87,7 @@ openerp.web_graph.GraphView = openerp.web.View.extend({
}
}, this);
this.ordinate = this.columns[0].name;
this.is_loaded.resolve();
},
schedule_chart: function(results) {
var self = this;
@ -371,13 +373,16 @@ openerp.web_graph.GraphView = openerp.web.View.extend({
},
do_search: function(domain, context, group_by) {
// TODO: handle non-empty group_by with read_group?
if (!_(group_by).isEmpty()) {
this.abscissa = group_by[0];
} else {
this.abscissa = this.first_field;
}
this.dataset.read_slice(this.list_fields(), {}, $.proxy(this, 'schedule_chart'));
var self = this;
return $.when(this.is_loaded).pipe(function() {
// TODO: handle non-empty group_by with read_group?
if (!_(group_by).isEmpty()) {
self.abscissa = group_by[0];
} else {
self.abscissa = self.first_field;
}
return self.dataset.read_slice(self.list_fields(), {}, $.proxy(self, 'schedule_chart'));
});
}
});
};