You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[IMP] util/inconsistencies.py: Allow auto-fix for UoM inconsistencies
- Improve UoM inconsistencies warning message. The `category_id` is no
longer displayed. The UoM and product names are now displayed to help
the customer to better understand the changes that need to be done.
- Add ODOO_MIG_FIX_ALL_UOM_INCONSISTENCIES environment variable to
allow the upgrade to fix the uom inconsistencies using the product
template UoM. The value can set to `1` to activate the uom fix. A
message is added in the migration reports to inform the customer about
the updated rows.
- Use ODOO_MIG_DO_NOT_IGNORE_ARCHIVED_PRODUCTS_FOR_UOM_INCONSISTENCIES
environment variable to allow the upgrade to list or fix the archived
uom inconsistencies. By default, archived product are not used. The
value can set to `1` to add archived products. The variable is also
used in the `verify_product` function.
tbg-71
Improved message to list uom inconsistencies
---
```
There is a UoM mismatch in some Stock Move Lines. The category of the UoM defined on the
Stock Move Line is different from that defined on the Product Template and must be the same to
avoid errors. We allowed the upgrade to continue, but these inconsistencies may cause error
during the upgrade or issues on the upgraded database.
To avoid any issue, here are the options to consider:
* fix these inconsistencies manually (below, the details of the affected records)
* let this script automatically fix the affected records by setting the environment variable
ODOO_MIG_FIX_ALL_UOM_INCONSISTENCIES to 1. It will take the UoM from the Product Template
and set it on the faulty Stock Move Lines.
You can also take the archived products into account for listing or fixing faulty lines by setting the
environment variable ODOO_MIG_DO_NOT_IGNORE_ARCHIVED_PRODUCTS_FOR_UOM_INCONSISTENCIES to 1
These Stock Move Lines have UoM inconsistencies:
* Stock Move Line(id=46) has UoM `kg`(id=12, category: `Weight`), Product Template `Drawer`(id=24) has UoM `Units`(id=1, category: `Unit`)
* Stock Move Line(id=45) has UoM `kg`(id=12, category: `Weight`), Product Template `Drawer`(id=24) has UoM `Units`(id=1, category: `Unit`)
```
New message in the logs to list fixed UoMs
---
```
Upon your request, we have automatically fixed the faulty UoMs by picking it from
the Product Template and setting it on the Stock Move Lines.
Please, take the time to check that the following Stock Move Lines inconsistencies have
been updated to the right UoM:
* Stock Move Line(id=46): Updated UoM from `kg`(id=12, category: `Weight`) to `Units`(id=1, category: `Unit`) for Product Template `Drawer`(id=24)
* Stock Move Line(id=45): Updated UoM from `kg`(id=12, category: `Weight`) to `Units`(id=1, category: `Unit`) for Product Template `Drawer`(id=24)
```
Part of odoo/upgrade#5207
Signed-off-by: Alvaro Fuentes Suarez (afu) <[email protected]>
0 commit comments