[FIX] mrp: Wrong decimal format in user error

When the produced quantity was a float, it only displayed the integer part.

opw:1837334
This commit is contained in:
Goffin Simon
2018-04-23 14:06:34 +02:00
parent 899ae6d3da
commit 32d5a31364
2 changed files with 4 additions and 3 deletions
+2 -2
View File
@@ -3528,9 +3528,9 @@ msgid "You cannot unbuild a undone manufacturing order."
msgstr ""
#. module: mrp
#: code:addons/mrp/wizard/change_production_qty.py:46
#: code:addons/mrp/wizard/change_production_qty.py:47
#, python-format
msgid "You have already processed %d. Please input a quantity higher than %d "
msgid "You have already processed %s. Please input a quantity higher than %s "
msgstr ""
#. module: mrp
+2 -1
View File
@@ -43,7 +43,8 @@ class ChangeProductionQty(models.TransientModel):
production = wizard.mo_id
produced = sum(production.move_finished_ids.filtered(lambda m: m.product_id == production.product_id).mapped('quantity_done'))
if wizard.product_qty < produced:
raise UserError(_("You have already processed %d. Please input a quantity higher than %d ")%(produced, produced))
format_qty = '%.{precision}f'.format(precision=precision)
raise UserError(_("You have already processed %s. Please input a quantity higher than %s ") % (format_qty % produced, format_qty % produced))
production.write({'product_qty': wizard.product_qty})
done_moves = production.move_finished_ids.filtered(lambda x: x.state == 'done' and x.product_id == production.product_id)
qty_produced = production.product_id.uom_id._compute_quantity(sum(done_moves.mapped('product_qty')), production.product_uom_id)