Missing conversion of unit price to company currency
The currency of unit price on move is defined by the currency field. So to compute the cost price, it should first be converted to the company currency. issue5057 review19561002
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
from decimal import Decimal
|
||||
from trytond.model import Workflow, ModelView, fields, Check
|
||||
from trytond.pool import Pool, PoolMeta
|
||||
from trytond.transaction import Transaction
|
||||
|
||||
__all__ = ['Move']
|
||||
__metaclass__ = PoolMeta
|
||||
@@ -36,8 +37,9 @@ class Move:
|
||||
fifo_quantity on the concerned incomming moves. Return the
|
||||
cost price for outputing the given product and quantity.
|
||||
'''
|
||||
|
||||
Uom = Pool().get('product.uom')
|
||||
pool = Pool()
|
||||
Uom = pool.get('product.uom')
|
||||
Currency = pool.get('currency.currency')
|
||||
|
||||
total_qty = Uom.compute_qty(self.uom, self.quantity,
|
||||
self.product.default_uom, round=False)
|
||||
@@ -49,7 +51,11 @@ class Move:
|
||||
for move, move_qty in fifo_moves:
|
||||
consumed_qty += move_qty
|
||||
|
||||
move_unit_price = Uom.compute_price(move.uom, move.unit_price,
|
||||
with Transaction().set_context(date=move.effective_date):
|
||||
move_unit_price = Currency.compute(
|
||||
move.currency, move.unit_price,
|
||||
self.company.currency, round=False)
|
||||
move_unit_price = Uom.compute_price(move.uom, move_unit_price,
|
||||
move.product.default_uom)
|
||||
cost_price += move_unit_price * Decimal(str(move_qty))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user