Monday, August 12, 2024
3 changes · saas-17.2
Resolved issues and error corrections
This fix reduces rounding errors when sales order quantities are calculated from product packaging. It helps prevent small packaging-based quantity adjustments from unexpectedly changing ordered amounts, improving accuracy for sales and inventory handling.
Original PR description
### Issue: The way that the `product_packaging_qty` field of the SOL model is defined and used can introduce an error on the qty of the SOL whose as high as half of the uom_rounding (seen as a…
### Issue: The way that the `product_packaging_qty` field of the SOL model is defined and used can introduce an error on the qty of the SOL whose as high as half of the uom_rounding (seen as a percentage) of the qty_per_package E.G. with an uom_rounding of 0.01 you can introduce an error on the qty of the SOL that is up to 0.5% of the qty per package. ### Steps to reproduce the issue: - Enable "Product Packagings" on products in the settings - Create a storable product with a packaging containing 999 units - Create a SO with a SOL for 1004 units of that product - Add your packaging on the SOL #### > the quantity went from 1004 to 1008.99 (error of 5 units that is 0.5%) ### Cause of the issue: Rounding a float number can introduce an error of up to 0.5 the rounding precision e.g. 0.005 rounds up to 0.01 with rounding precision 0.01 which is is an error of half of its rounding precision. The `product_uom_qty` of an SOL is computed by making the product of the `product_packaging_qty` with the `qty_per_packaging`: https://github.com/odoo/odoo/blob/0ffe4cbb5a112b3885f3b624872180bf7bc31891/addons/sale/models/sale_order_line.py#L424-L425 As such, the `product_packaging_qty` is a ratio meant to be re-multiplied with product uom quantities. However, the `product_packaging_qty` is computed with the rounding precision of the `product_uom`: https://github.com/odoo/odoo/blob/0ffe4cbb5a112b3885f3b624872180bf7bc31891/addons/product/models/product_packaging.py#L80 Therefore the `product_packaging_qty` can carry an error as high as half of the `uom_rounding`, that is, most often up to 0.5%. This introduce an error on the `product_uom_qty` that can therefore be as high as 0.5% of the `qty_per_packaging`. ### Fix: Since each of the qty appearing in the quotients and products are rounded, it is impossible to avoid completely any rounding issue but since the `product_packaging_qty` is a ratio that is meant to be remultiplied by a product uom quantity its precision should as high as possible to not introduce any percentage deviation on the quantity. opw-4057874 --- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr
This update brings the spreadsheet component up to the latest version for Odoo 17.2. It fixes issues around formula evaluation, invalid sheet references, and formatting updates, helping spreadsheets behave more reliably for users.
Original PR description
### Contains the following commits: https://github.com/odoo/o-spreadsheet/commit/d667a15ba [REL] 17.2.20 Task: 0 https://github.com/odoo/o-spreadsheet/commit/c767b2b2a [FIX] evaluation: add a getter to evaluate value and format Task: 4102210 https://github.com/odoo/o-spreadsheet/commit/da1637eff [FIX] ranges: getRangeFromSheetXC with invalid sheetId Task: 3578461 https://github.com/odoo/o-spreadsheet/commit/a32470f45 [FIX] format: dispatch only once Task: 4091502 Co-authored-by: Anthony Hendrickx (anhe) <anhe@odoo.com> Co-authored-by: Alexis Lacroix (laa) <laa@odoo.com> Co-authored-by: Lucas Lefèvre (lul) <lul@odoo.com> Co-authored-by: Dhrutik Patel (dhrp) <dhrp@odoo.com> Co-authored-by: Adrien Minne (adrm) <adrm@odoo.com> Co-authored-by: Mehdi Rachico (mera) <mera@odoo.com> Co-authored-by: Rémi Rahir (rar) <rar@odoo.com> Co-authored-by: Pierre Rousseau (pro) <pro@odoo.com> Co-authored-by: Vincent Schippefilt (vsc) <vsc@odoo.com>
Sharing a project opened from a sales order now creates the correct project link instead of mistakenly using the sales order link. This prevents errors in the share wizard and helps users reliably share project access with customers or collaborators.
Original PR description
### Steps to reproduce: - Install Sale and Project modules - Create a service product that creates project - Create a quotation with the created service product and confirm it - Click on the project smart button - Try sharing the project ### Current behavior before PR: An error gets triggered when trying to share a project from SO. This happens because the share link that is shown in the share project wizard is not the correct one /mail/view?model=sale.order&res_id=318&access_token=" it will have the sale.order data because of the action_stack the context will have the active_model as sale.order and active_id as SO id which will lead to generation of the wrong link. ### Desired behavior after PR is merged: While opening the share project wizard we will add the project's data to the context to replace the sale.order data so we can have the link generated correctly /mail/view?model=project.project&res_id=178&access_token= opw-4087926