[IMP] document_page_reference: add option to create a new page from a non-existing reference

This commit is contained in:
Jordi Ballester Alomar
2019-11-29 14:31:58 +01:00
committed by Anusha
parent 958c70d670
commit 51ddc0a45b
5 changed files with 99 additions and 15 deletions

View File

@@ -14,11 +14,18 @@ odoo.define('document_page_reference.backend', function (require) {
event.preventDefault();
event.stopPropagation();
var element = $(event.target).closest('.oe_direct_line')[0];
var default_reference = element.name;
var model = $(event.target).data('oe-model');
var id = $(event.target).data('oe-id');
var context = this.record.getContext(this.recordParams);
if (default_reference){
context['default_reference'] = default_reference
}
this._rpc({
model: element.name,
model: model,
method: 'get_formview_action',
args: [[parseInt(element.dataset.id)]],
context: this.record.getContext(this.recordParams),
args: [[parseInt(id)]],
context: context,
})
.then(function (action) {
self.trigger_up('do_action', {action: action});