mirror of
https://github.com/OCA/web.git
synced 2025-02-22 13:21:25 +02:00
@@ -37,7 +37,7 @@ in the field's options dict
|
||||
|
||||
``open`` *boolean* (Default: ``False``)
|
||||
|
||||
Makes many2many_tags buttons that open the linked resource
|
||||
Makes many2many_tags and one2many rows buttons that open the linked resource
|
||||
|
||||
``no_color_picker`` *boolean* (Default: ``False``)
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ odoo.define('web_m2x_options.web_m2x_options', function (require) {
|
||||
var _t = core._t,
|
||||
FieldMany2ManyTags = relational_fields.FieldMany2ManyTags,
|
||||
FieldMany2One = relational_fields.FieldMany2One,
|
||||
FieldOne2Many = relational_fields.FieldOne2Many,
|
||||
FormFieldMany2ManyTags = relational_fields.FormFieldMany2ManyTags;
|
||||
|
||||
var web_m2x_options = rpc.query({
|
||||
@@ -355,6 +356,27 @@ odoo.define('web_m2x_options.web_m2x_options', function (require) {
|
||||
},
|
||||
});
|
||||
|
||||
FieldOne2Many.include({
|
||||
_onOpenRecord: function (ev) {
|
||||
var self = this;
|
||||
var open = this.nodeOptions.open;
|
||||
if (open && self.mode === 'readonly') {
|
||||
ev.stopPropagation();
|
||||
var id = ev.data.id;
|
||||
var res_id = self.record.data[self.name].data.filter(line => line.id === id)[0].res_id;
|
||||
self._rpc({
|
||||
model: self.field.relation,
|
||||
method: 'get_formview_action',
|
||||
args: [[res_id]],
|
||||
}).then(function (action) {
|
||||
return self.do_action(action);
|
||||
});
|
||||
} else {
|
||||
return this._super.apply(this, arguments);
|
||||
};
|
||||
},
|
||||
});
|
||||
|
||||
FormFieldMany2ManyTags.include({
|
||||
events: _.extend({}, FormFieldMany2ManyTags.prototype.events, {
|
||||
'click .badge': '_onOpenBadge',
|
||||
|
||||
Reference in New Issue
Block a user