[10.0] [FIX] [web_timeline] Correct write when grouped by (#678)

* [FIX] Correct write when grouped by

* Remove blank lines

* Minor changes
pull/704/head
Jose M 2017-08-17 13:35:33 +02:00 committed by Holger Brunn
parent 97b6b48a69
commit e17f516cc0
1 changed files with 5 additions and 1 deletions

View File

@ -36,6 +36,7 @@ odoo.define('web_timeline.TimelineView', function (require) {
init: function (parent, dataset, view_id, options) {
this.permissions = {};
this.grouped_by = false;
return this._super.apply(this, arguments);
},
@ -283,6 +284,7 @@ odoo.define('web_timeline.TimelineView', function (require) {
var self = this;
var data = [];
var groups = [];
this.grouped_by = group_bys;
_.each(events, function(event) {
if (event[self.date_start]){
data.push(self.event_data_transform(event));
@ -404,7 +406,9 @@ odoo.define('web_timeline.TimelineView', function (require) {
time.auto_date_to_str(start, self.fields[self.fields_view.arch.attrs.date_start].type);
data[self.fields_view.arch.attrs.date_stop] =
time.auto_date_to_str(end, self.fields[self.fields_view.arch.attrs.date_stop].type);
data[self.fields_view.arch.attrs.default_group_by] = group;
if (self.grouped_by){
data[self.grouped_by[0]] = group;
}
var id = item.evt.id;
this.dataset.write(id, data);
},