6e1975817106e7212ffe59d85e4c77ca0d9f77c5
Steps to reproduce the bug: - Open a product page in edit mode. - Replace the main image with one of your own. - Click on the "Remove" button. -> Nothing happens and the "Remove" button has to be clicked one more time in order to work properly. The goal of this commit is to remove the need of the double clicking operation in order to remove a media. Before this commit, here was the process that happened at the removal of the main product image: - `'/shop/product/remove-image'` was called and the field `image_1920` of the record (`product.product`) was set to `False`. - A `request_save` was triggered up. - At the "request save", the `Wysiwyg` performs two main actions: 1) `saveModifiedImages()`: Using the `o_modified_image_to_save` class, the `Wysiwyg` saves the updated version of the image and sets its new attachment URL in the `src` attribute before completing the save process. 2) `_saveViewBlocks()`: in `save_embedded_field()`, the field `image_1920` of `product.product` is updated tanks to the value saved in the new created attachment. The problem here is double: first, a useless attachment is created while the user wants to delete the image. Second, at the end of the process, the field `image_1920` of the `product.product` is not set to `False` anymore. To resolve this problem, the image is removed from the DOM before the "request save". Thanks to that, no attachment is created at the "request save". Moreover, because the image is removed, the field `image_1920` of `product.product` is set to `False` at `save_embedded_field()` (see `Image.from_html()`). Note that the rpc call to `remove_product_image()` has been removed. Indeed, the modification of the `image_1920` field of the records of type `product.product` and `product.template` is now handled in `save_embedded_field()`. The `unlink()` of the `product.image` is kept because the record has to be deleted at the remove of a secondary image. task-3111601 closes odoo/odoo#133546 X-original-commit: 00c5a939f622fb90e6d390012c0fcd458fdfe6d1 Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
…
…
…
Odoo
Odoo is a suite of web based open source business apps.
The main Odoo Apps include an Open Source CRM, Website Builder, eCommerce, Warehouse Management, Project Management, Billing & Accounting, Point of Sale, Human Resources, Marketing, Manufacturing, ...
Odoo Apps can be used as stand-alone applications, but they also integrate seamlessly so you get a full-featured Open Source ERP when you install several Apps.
Getting started with Odoo
For a standard installation please follow the Setup instructions from the documentation.
To learn the software, we recommend the Odoo eLearning, or Scale-up, the business game. Developers can start with the developer tutorials
Languages
Python
49.6%
JavaScript
47.8%
SCSS
2%
CSS
0.3%
HTML
0.2%