[FIX] web_editor: do not create variant image while selecting an image
Steps to reproduce the bug: - Go on a product page of a product with multiple variants but no image set for those variants. Because there is no image set to those variants, the variant images fall back on the template image. - Edit. - Click on the variant image of the product. (Note that `.o_dirty` is added to the element). - Save. -> The image of the product is not the template image anymore but a variant image that is the same as the template image. Because `.o_dirty` is added while clicking on the product image, `save_embedded_field()` will set the `image_1920` field of `product.product`. Because the product has multiple variants, the `image_variant_1920` field of `product.product` is modified see (`_set_template_field()`). The problem is that the `o_dirty` class is added on the clicked element. To solve the problem, the `MutationObserver` responsible for adding this class is paused when modifying the tooltips. Note that it was introduced by [1] but it was broken since [2]. [1]: https://github.com/odoo/odoo/commit/9f93fa8e77b11da2fcf60f606784eec49a94778a [2]: https://github.com/odoo/odoo/commit/8eb0ca54200f0f8e1078bb6a0d507e747ccea122 task-3111601 X-original-commit: 3b8f601f95845d65a515e9c8bb8e25cc17565dbf Part-of: odoo/odoo#133546
This commit is contained in:
@@ -2179,13 +2179,13 @@ export class Wysiwyg extends Component {
|
||||
if (!this.showTooltip || $target.attr('title') !== undefined) {
|
||||
return;
|
||||
}
|
||||
this.odooEditor.observerUnactive();
|
||||
// Tooltips need to be cleared before leaving the editor.
|
||||
this.saving_mutex.exec(() => {
|
||||
this.odooEditor.observerUnactive();
|
||||
$target.tooltip({title: _t('Double-click to edit'), trigger: 'manual', container: 'body'}).tooltip('show');
|
||||
this.odooEditor.observerActive();
|
||||
this.tooltipTimeouts.push(setTimeout(() => $target.tooltip('dispose'), 800));
|
||||
});
|
||||
this.odooEditor.observerActive();
|
||||
}, 400));
|
||||
}
|
||||
// Hide button groups that have no visible buttons.
|
||||
|
||||
Reference in New Issue
Block a user