콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
4385 화면

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
아바타
취소
관련 게시물 답글 화면 활동
1
5월 23
7318
1
7월 16
4164
1
6월 23
3105
0
1월 21
2865
2
12월 19
8563