Skip to Content
Menu
This question has been flagged

With the right click on the record i get a copy of it, but how to call the edit form when performing this process?

odoo.define('contextmenu.web', function (require) {
"use strict";

var ListController = require('web.ListController');
var ListRenderer = require('web.ListRenderer');

ListController.include({
custom_events: _.extend({}, ListController.prototype.custom_events, {
duplicate_record: '_onDuplicateRecord',
}),

_onDuplicateRecord: function(event) {
event.stopPropagation();
var self = this;
this.handle = event.data.id;
this.model.duplicateRecord(this.handle);
},
});

ListRenderer.include({
events: _.extend({}, ListRenderer.prototype.events, {
'contextmenu tbody tr': '_onContextMenu',
}),

_onContextMenu: function(event) {
var target = event.target;
while (target.tagName !== 'TR') {
target = target.parentNode;
}
if (target.className === 'o_data_row') {
var id = $(event.currentTarget).data('id');
if (id) {
this.trigger_up('duplicate_record', { id: id, target: target });
}
}
},
});

});

Should I use this option?
this.model.duplicateRecord(this.handle)
.then(function (handle) {
self.handle = handle;
self._updateEnv();
self._setMode('edit');
});


If yes, why this problem occurs?
ERROR: Cannot read property 'length' of undefined
Avatar
Discard
Related Posts Replies Views Activity
1
May 23
4872
1
Jul 16
2755
1
Jun 23
1592
0
Jan 21
1731
2
Dec 19
6996