[IMP] web_timeline: Ability to duplicate record

[IMP] web_timeline: Ability to duplicate record
This commit is contained in:
tarteo
2019-10-17 15:30:52 +02:00
parent 3f07f00ef2
commit bf168d5657
5 changed files with 85 additions and 1 deletions

View File

@@ -16,6 +16,7 @@ odoo.define('web_timeline.TimelineController', function (require) {
onRemove: '_onRemove',
onMove: '_onMove',
onAdd: '_onAdd',
onDuplicate: '_onDuplicate'
}),
/**
@@ -133,6 +134,25 @@ odoo.define('web_timeline.TimelineController', function (require) {
}
},
/**
* Gets triggered when a timeline item is duplicated (triggered by the TimelineRenderer).
*
* @private
*/
_onDuplicate: function (event) {
var self = this;
return this._rpc({
model: this.model.modelName,
method: 'copy',
args: [event.data.id],
context: this.getSession().user_context,
})
.then(function (res_id) {
self.create_completed([res_id]);
event.data.callback();
});
},
/**
* Gets triggered when a timeline item is moved (triggered by the TimelineRenderer).
*