Skip to content

Commit 42049f0

Browse files
yajopedrobaeza
authored andcommitted
Fix Qweb templates. (OCA#561)
* [FIX][web_m2x_options] Fix Qweb templates. They were trying to replace non-existing elements, and this was being logged to console: Can't find "a.oe_m2o_cm_button" when extending template FieldMany2One Can't find "span.badge" when extending template FieldMany2ManyTag * Raise version correctly. * [FIX] Make many2many_tags tag deletion work again * Correct replacement of event Instead of overwriting all events from upstream widget, better just overwrite the one you need and inherit the rest.
1 parent c5f6632 commit 42049f0

4 files changed

Lines changed: 15 additions & 19 deletions

File tree

web_m2x_options/README.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ Your XML form view definition could contain::
116116
Known issues
117117
============
118118

119-
Double check that you have no inherited view that remove ``options`` you set on a field !
119+
Double check that you have no inherited view that remove ``options`` you set on a field !
120120
If nothing works, add a debugger in the first line of ``get_search_result method`` and enable debug mode in Odoo. When you write something in a many2one field, javascript debugger should pause. If not verify your installation.
121121

122122
Roadmap
@@ -146,6 +146,7 @@ Contributors
146146
* Nicolas JEUDY <nicolas@sudokeys.com>
147147
* Yannick Vaucher <yannick.vaucher@camptocamp.com>
148148
* Zakaria Makrelouf <z.makrelouf@gmail.com>
149+
* Jairo Llopis <jairo.llopis@tecnativa.com>
149150

150151
Maintainer
151152
----------

web_m2x_options/__openerp__.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
{
44
"name": 'web_m2x_options',
5-
"version": "9.0.1.0.0",
5+
"version": "9.0.1.1.0",
66
"depends": [
77
'base',
88
'web',
@@ -12,6 +12,7 @@
1212
],
1313
'license': 'AGPL-3',
1414
'data': ['views/view.xml'],
15-
"author": "ACSONE SA/NV, 0k.io,Odoo Community Association (OCA)",
15+
"author": "ACSONE SA/NV, 0k.io, Tecnativa, "
16+
"Odoo Community Association (OCA)",
1617
'installable': True,
1718
}

web_m2x_options/static/src/js/form.js

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -260,13 +260,9 @@ odoo.define('web_m2x_options.web_m2x_options', function (require) {
260260
});
261261

262262
form_relational.FieldMany2ManyTags.include({
263-
events: {
264-
'click .o_delete': function(e) {
265-
this.remove_id($(e.target).parent().data('id'));
266-
},
267-
'click .badge': 'open_badge',
268-
'mousedown .o_colorpicker span': 'update_color',
269-
'focusout .o_colorpicker': 'close_color_picker',
263+
init: function () {
264+
this.events["click .badge"] = "open_badge";
265+
return this._super.apply(this, arguments);
270266
},
271267
show_error_displayer: function () {
272268
if ((typeof this.options.m2o_dialog === 'undefined' && this.can_create) ||
Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2+
<!-- Copyright 2017 Jairo Llopis <jairo.llopis@tecnativa.com>
3+
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
4+
25
<templates xml:space="preserve">
3-
<t t-extend="FieldMany2One">
4-
<t t-jquery="a.oe_m2o_cm_button">
5-
jQuery(this).attr('t-if', '!(widget.options.no_open || widget.options.no_open_edit)');
6+
<t t-extend="FieldMany2One">
7+
<t t-jquery=".oe_m2o_cm_button" t-operation="attributes">
8+
<attribute name="t-if">!(widget.options.no_open || widget.options.no_open_edit)</attribute>
9+
</t>
610
</t>
7-
</t>
8-
<t t-extend="FieldMany2ManyTag">
9-
<t t-jquery="span.badge">
10-
jQuery(this).attr('t-att-data-id', 'el[0]');
11-
</t>
12-
</t>
1311
</templates>

0 commit comments

Comments
 (0)