a60cced44810d708beaf8ea5a166aa554a7c852b
Currently, when adding a product to a quotation with the catalog, no warning message will appear when adding a poduct that has a warning or blocking message. Steps to reproduce: ------------------- * Go to **Sales** app -> Configuration -> Settings * Enable **Sale Warnings** * Go to **Products** -> Products * Create a new product * Under **Sales** tab: * For warning, select either warning or blocking message * Write a message * Go to **Orders** -> Quotations * Create a new quotation * Select the **Catalog** to add products * Add the newly created product Why the fix: ------------ The first version of this fix was a python exclusive change. It was a bit hacky; it was raising an error when the product had a blocking warning and sending a message on the bus when the product had a non-blocking warning. The second version was changing the return value of `_update_order_line_info` to return the price and the warning if any. The warning was shown inside JS with `_updateQuantity`. This change was not good for a stable verion as it was changing the signature of a public method. This fix automatically changes the data that is loaded to the catalog. It adds the warning message if any and changes the `readOnly` field accordingly. Warning/blocking messages will be automatically displayed in the catalog, on the product informations. Products with blocking messages will me marked as readonly to avoid being able to add the product to the sale order (this is the original behavior for blocking messages). Regarding the field `readOnly` and ẁarning`: * We can't write `res[product.id]['readOnly'] = product.sale_line_warn == "block"' because readOnly is set to True by default if the sale order is cancelled and doing this would overide that value later. See: https://github.com/odoo/odoo/blob/21c25a7ccd0ba2d6574ddbcfbcf50dbbc03a1e6c/addons/product/models/product_catalog_mixin.py#L97-L99 * We're also sending the warning only if there is one because of this: ```python <span t-elif="props.readOnly" class="my-2 pt-3 border-top" t-out="props.warning"> You can't edit this product in the catalog. </span> ``` Because in the case where readOnly is True for another reason than the product having a blocking warning, the initial message will be displyed. Since the module purchase also uses the warning on products, this fix is extended to include it. opw-3631511 closes odoo/odoo#149155 Signed-off-by: Valentin Chevalier <vcr@odoo.com> Co-authored-by: Valentin Chevalier <vcr@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%