From d0dbd570b628cc82183ddec6b78a49c88d4f12ef Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Fri, 12 Jan 2018 11:03:17 +0100 Subject: [PATCH] [FIX] mrp: digits in move.production.lots Add decimal precision to quantitites in stock.production.lots. Otherwise, if the UoM uses a DP larger than 2, inconsistencies may arise since the field is automatically rounded to 2 decimals in the interface. For example, if the DP of the UoM is 4: - Set Qty Done to 1.234567 - Save => qty recorded in DB is 1.234567 - Edit, change nothing and save => qty recorded in DB is 1.23 This happens since the web client parses the value in the DOM and detects a value change. opw-788078 --- addons/mrp/models/stock_move.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/addons/mrp/models/stock_move.py b/addons/mrp/models/stock_move.py index 6671cb0a215..661de7c93a9 100644 --- a/addons/mrp/models/stock_move.py +++ b/addons/mrp/models/stock_move.py @@ -18,9 +18,11 @@ class StockMoveLots(models.Model): 'stock.production.lot', 'Lot', domain="[('product_id', '=', product_id)]") lot_produced_id = fields.Many2one('stock.production.lot', 'Finished Lot') - lot_produced_qty = fields.Float('Quantity Finished Product', help="Informative, not used in matching") - quantity = fields.Float('To Do', default=1.0) - quantity_done = fields.Float('Done') + lot_produced_qty = fields.Float( + 'Quantity Finished Product', digits=dp.get_precision('Product Unit of Measure'), + help="Informative, not used in matching") + quantity = fields.Float('To Do', default=1.0, digits=dp.get_precision('Product Unit of Measure')) + quantity_done = fields.Float('Done', digits=dp.get_precision('Product Unit of Measure')) product_id = fields.Many2one( 'product.product', 'Product', readonly=True, related="move_id.product_id", store=True)