Skip to content

Commit

Permalink
[FIX] mrp: digits in move.production.lots
Browse files Browse the repository at this point in the history
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
  • Loading branch information
nim-odoo committed Jan 12, 2018
1 parent 4357783 commit d0dbd57
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions addons/mrp/models/stock_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit d0dbd57

Please sign in to comment.