Convert unit price to company currency and default product uom
issue9439 review325641002
This commit is contained in:
@@ -408,6 +408,7 @@ class ShipmentDrop(Workflow, ModelSQL, ModelView):
|
||||
pool = Pool()
|
||||
UoM = pool.get('product.uom')
|
||||
Move = pool.get('stock.move')
|
||||
Currency = pool.get('currency.currency')
|
||||
|
||||
to_save = []
|
||||
for shipment in shipments:
|
||||
@@ -425,10 +426,15 @@ class ShipmentDrop(Workflow, ModelSQL, ModelView):
|
||||
for s_move in shipment.supplier_moves:
|
||||
if s_move.state == 'cancelled':
|
||||
continue
|
||||
if s_move.cost_price:
|
||||
internal_quantity = Decimal(str(s_move.internal_quantity))
|
||||
product_cost[s_move.product] += (
|
||||
s_move.unit_price * internal_quantity)
|
||||
internal_quantity = Decimal(str(s_move.internal_quantity))
|
||||
with Transaction().set_context(date=s_move.effective_date):
|
||||
unit_price = Currency.compute(
|
||||
s_move.currency, s_move.unit_price,
|
||||
s_move.company.currency, round=False)
|
||||
unit_price = UoM.compute_price(
|
||||
s_move.uom, unit_price, s_move.product.default_uom)
|
||||
product_cost[s_move.product] += (
|
||||
unit_price * internal_quantity)
|
||||
|
||||
quantity = UoM.compute_qty(
|
||||
s_move.uom, s_move.quantity, s_move.product.default_uom,
|
||||
|
||||
Reference in New Issue
Block a user