Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FIX] mrp: give default value when precision rounding value is zero
The traceback arises when the user removes the 'product' from 'stock.move' and try to add the product in 'mrp.production'. To reproduce this issue: 1) Install 'MRP' 2) Create a new record for 'Manufacturing Order' 3) First add a line in 'Components' 4) Remove the 'product_id' from component 5) Now try to add 'Product' in mrp Error:-"AssertionError: precision_rounding must be positive, got 0.0" on the '_compute_state' method when the state is in 'draft' and the user added a line in 'move_raw_ids'. In this case, precision_rounding is getting value from 'product_uom.rounding' or 'product_id.uom_id.rounding' through 'move_raw_ids'. See:- https://github.com/odoo/odoo/blob/10e0ac377cc235d81819eaa2a4ec2b6a60fffd70/addons/mrp/models/mrp_production.py#L478-#L479 When the user removed 'product_id' from 'move_raw_ids', 'precision_rounding' will be '0.00'. Which leads to the above traceback. Applying this commit will resolve the issue by giving a default value of '0.01', when the 'precision_rounding' value is '0.00'. sentry-4220927307 closes odoo#137904 X-original-commit: 5c238bb Signed-off-by: Djamel Touati (otd) <otd@odoo.com> Signed-off-by: Altaf Shaik (alsh) <alsh@odoo.com>
- Loading branch information