From ffdc7762d9006d071f83b44cdbd019e984fd6a27 Mon Sep 17 00:00:00 2001 From: Oscar Alvarez Date: Sat, 6 Oct 2012 21:18:20 -0500 Subject: [PATCH] Fix production Round compute of unit_price issue2764 review501004 --- production.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/production.py b/production.py index 515ccbc3b2..b52049cd72 100644 --- a/production.py +++ b/production.py @@ -258,7 +258,7 @@ class Production(Workflow, ModelSQL, ModelView): def explode_bom(self): pool = Pool() Uom = pool.get('product.uom') - + Template = pool.get('product.template') if not (self.bom and self.product and self.uom): return {} inputs = { @@ -300,8 +300,10 @@ class Production(Workflow, ModelSQL, ModelView): if values: values['unit_price'] = Decimal(0) if output.product.id == values.get('product') and quantity: - values['unit_price'] = (changes['cost'] / - Decimal(str(quantity))) + digits = Template.cost_price.digits[1] + values['unit_price'] = Decimal( + changes['cost'] / Decimal(str(quantity)) + ).quantize(Decimal(str(10 ** -digits))) outputs['add'].append(values) return changes