Fix missing unit_price currency convertion

issue3072
review731002
(transplanted from acd9a30f1c147a7c8637201c6b829ef1dd67b21a)
This commit is contained in:
Cédric Krier committed 2013-03-25 19:30:02 +01:00
1 parent c50c922413
commit eae581d717
1 file changed
+7 -2
+7 -2
View File
@@ -98,7 +98,9 @@ class Move:
Return the cost for quantity based on lines.
Update anglo_saxon_quantity on the concerned moves.
'''
Uom = Pool().get('product.uom')
pool = Pool()
Uom = pool.get('product.uom')
Currency = pool.get('currency.currency')
for move in moves:
assert move.product == product, 'wrong product'
@@ -114,8 +116,11 @@ class Move:
consumed_qty += move_qty
if type_.startswith('in_'):
with Transaction().set_context(date=move.effective_date):
unit_price = Currency.compute(move.currency,
move.unit_price, move.company.currency, round=False)
move_cost_price = Uom.compute_price(move.uom,
move.unit_price, move.product.default_uom)
unit_price, move.product.default_uom)
else:
move_cost_price = move.cost_price
cost += move_cost_price * Decimal(str(move_qty))