I developed a Odoo18 Modulo to permit the user to change the UOM in POS, it is almos ready, the unique issue is taht a odoo validation to say : You cannot change the unit of measure as there are already stock moves for this product ... do you have any idea, to resolve this...
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Účtovníctvo
- Sklady
- PoS
- Project
- MRP
This question has been flagged
Hi,
The issue occurs because Odoo prevents changing a product’s Unit of Measure (UoM) once stock moves already exist for that product. This restriction is a built-in validation designed to maintain inventory accuracy and avoid inconsistencies in valuation and stock calculations. In Odoo 18, the validation comes from the _check_uom method in the product.template or product.product model, which raises the error: “You cannot change the unit of measure as there are already stock moves for this product.”
If the goal is to allow users to change the UoM within the Point of Sale (POS) without affecting the product’s master data, it’s best not to modify the base UoM directly. Instead, a separate temporary field (e.g., pos_uom_id) can be used in the POS model or order line to handle UoM conversions dynamically. This approach allows correct quantity and price calculations without triggering the core validation.
While it’s technically possible to override the _check_uom constraint to bypass this restriction, doing so is risky and can lead to data inconsistencies in inventory and accounting. The recommended solution is to manage UoM changes only at the POS line level, using Odoo’s built-in conversion methods like product_uom._compute_quantity() to handle unit conversions safely.
Refer to the following module:-
https://apps.odoo.com/apps/modules/17.0/product_multi_uom_pos
Hope it helps
i tried bypassed adding a product model but it isnot work, do you have a code example for that?
Yeah, that’s a common one — Odoo blocks the UoM change if there are stock moves linked to the product. Easiest workaround is not to touch the main UoM but use a separate field or handle the conversion in POS directly. Otherwise, you’ll need to bypass that constraint in code, but do it carefully to avoid messing up inventory consistency.
i tried bypassed adding a product model but it isnot work, do you have a code example for that?
Enjoying the discussion? Don't just read, join in!
Create an account today to enjoy exclusive features and engage with our awesome community!
Registrácia