[FIX] stock: prevent edit mode when resolving WO conflicts

To reproduce the issue:
(Install mrp)
1. Create a conflict between two work orders
2. Open one MO > Work Orders, click on the danger symbol

Error: The form has switched into edit mode

In case of a 2many field, if one of the inner fields has the class
`o_widget`, the quick edit feature is disabled for that inner field:
https://github.com/odoo/odoo/blob/7ad3c62b60965139fab06227cb4e941720fed8c2/addons/web/static/src/legacy/js/fields/relational_fields.js#L1121-L1125
This class is automatically added on JS-side, during the rendering
thanks to `_renderWidget`:
https://github.com/odoo/odoo/blob/80acf449bcaf5ff3d2ba81d84efc0498bc78c533/addons/web/static/src/legacy/js/views/basic/basic_renderer.js#L842
However, in the above case, because this is a widget defined explicitly
on the field:
https://github.com/odoo/odoo/blob/5682015958d03f4a65969afe3fce9b9b05e5b505/addons/mrp/views/mrp_workorder_views.xml#L101
It leads to `_renderFieldWidget` which does not automatically add the
class `o_widget`
https://github.com/odoo/odoo/blob/80acf449bcaf5ff3d2ba81d84efc0498bc78c533/addons/web/static/src/legacy/js/views/basic/basic_renderer.js#L726

OPW-2887413

X-original-commit: b7225f415a545e7fd204a7ab4d1114ac680aeea1
Part-of: odoo/odoo#95087
This commit is contained in:
Adrien Widart
2022-07-01 17:48:23 +02:00
parent 9f39ca12ae
commit 019f96559f
@@ -35,6 +35,7 @@ var PopoverWidgetField = AbstractField.extend({
}
this.$el.css('max-width', '17px');
this.$el.html(QWeb.render(this.buttonTemplape, _.defaults(value, {color: this.color, icon: this.icon})));
this.$el.addClass('o_widget');
this.$el.find('a').prop('special_click', true);
this.$popover = $(QWeb.render(value.popoverTemplate || this.popoverTemplate, value));
this.$popover.on('click', '.action_open_forecast', this._openForecast.bind(this));