[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
This commit is contained in:
Nicolas Martinelli
2018-01-12 13:48:38 +01:00
committed by Nicolas Martinelli
parent 4357783a58
commit d0dbd570b6
+5 -3
View File
@@ -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)