Pular para o conteúdo
Menu
Esta pergunta foi sinalizada
4374 Visualizações

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
Cancelar
Publicações relacionadas Respostas Visualizações Atividade
1
mai. 23
7318
1
jul. 16
4164
1
jun. 23
3104
0
jan. 21
2862
2
dez. 19
8563