Browse Source

Cosmetic changes (to skip or squash)

Signed-off-by: adrien.didenot <adrien.didenot@horanet.com>
pull/1090/head
adrien.didenot 7 years ago
committed by tarteo
parent
commit
d0947df264
  1. 19
      web_timeline/static/src/js/web_timeline.js

19
web_timeline/static/src/js/web_timeline.js

@ -67,7 +67,12 @@ odoo.define('web_timeline.TimelineView', function (require) {
this.colors = _(this.fields_view.arch.attrs.colors.split(';')).chain().compact().map(function (color_pair) {
var pair = color_pair.split(':'), color = pair[0], expr = pair[1];
var temp = py.parse(py.tokenize(expr));
return {'color': color, 'field': temp.expressions[0].value, 'opt': temp.operators[0], 'value': temp.expressions[1].value};
return {
'color': color,
'field': temp.expressions[0].value,
'opt': temp.operators[0],
'value': temp.expressions[1].value
};
}).value();
}
},
@ -280,7 +285,11 @@ odoo.define('web_timeline.TimelineView', function (require) {
var ids = _.pluck(events, "id");
return this.dataset.name_get(ids).then(function (names) {
var nevents = _.map(events, function (event) {
return _.extend({__name: _.detect(names, function(name) { return name[0] == event.id; })[1]}, event);
return _.extend({
__name: _.detect(names, function (name) {
return name[0] == event.id;
})[1]
}, event);
});
return self.on_data_loaded_2(nevents, group_bys);
});
@ -305,7 +314,9 @@ odoo.define('web_timeline.TimelineView', function (require) {
_.each(events, function (event) {
var group_name = event[_.first(group_bys)];
if (group_name) {
var group = _.find(groups, function(group) { return _.isEqual(group.id, group_name[0]); });
var group = _.find(groups, function (group) {
return _.isEqual(group.id, group_name[0]);
});
if (group === undefined) {
group = {id: group_name[0], content: group_name[1]};
groups.push(group);
@ -421,11 +432,13 @@ odoo.define('web_timeline.TimelineView', function (require) {
on_remove: function (item, callback) {
var self = this;
function do_it() {
return $.when(self.dataset.unlink([item.evt.id])).then(function () {
callback(item);
});
}
if (this.options.confirm_on_delete) {
if (confirm(_t("Are you sure you want to delete this record ?"))) {
return do_it();

Loading…
Cancel
Save