[FIX] web: adding toggle to view with studio

Steps to reproduce:
- edit RFQ model with studio
- add a toggle widget to the product list
- activate/deactivate the toggle multiple times on different products

Bug:
sometimes the element on the widget is undefined when trying to rerender

Fix:
check the element is defined before trying to render it

opw-3013024

closes odoo/odoo#106614

X-original-commit: 1b09a6314dbce9363f4785c670033f41846359ad
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Walid Hanniche (waha) <waha@odoo.com>
This commit is contained in:
Walid HANNICHE (waha)
2022-11-25 19:51:59 +01:00
parent a3e9c525f5
commit 7214345b25
@@ -789,6 +789,9 @@ var BasicRenderer = AbstractRenderer.extend(WidgetAdapterMixin, {
// associated to new widget)
var self = this;
def.then(function () {
if(!widget.$el){
return;
}
// when the caller of renderFieldWidget uses something like
// this.renderFieldWidget(...).addClass(...), the class is added on
// the temporary div and not on the actual element that will be