Please review this at http://codereview.appspot.com/942041/show
Affected files:
M move.py
Index: move.py
===================================================================
--- a/move.py
+++ b/move.py
@@ -40,7 +40,7 @@
:param context: the context
:return: cost_price (of type decimal)
'''
-
+ product_obj = self.pool.get('product.product')
template_obj = self.pool.get('product.template')
uom_obj = self.pool.get('product.uom')
@@ -82,7 +82,12 @@
cost_price = cost_price / Decimal(str(consumed_qty))
if cost_price != Decimal("0"):
- return cost_price
+ if hasattr(product_obj, 'cost_price'):
+ digits = product_obj.cost_price.digits
+ else:
+ digits = product_template_obj.cost_price.digits
+ return cost_price.quantize(
+ Decimal(str(10.0**-digits[1])))
else:
return product.cost_price
--
Cédric Krier
B2CK SPRL
Rue de Rotterdam, 4
4000 Liège
Belgium
Tel: +32 472 54 46 59
Email/Jabber: [email protected]
Website: http://www.b2ck.com/
pgp2TRRFi3GTt.pgp
Description: PGP signature
