Add unit_price_company Function field on stock move
issue9401 review290341002
This commit is contained in:
@@ -107,11 +107,10 @@ class Move(metaclass=PoolMeta):
|
||||
'cost_price', **self._cost_price_pattern)
|
||||
|
||||
# Compute average cost price
|
||||
unit_price = self.unit_price
|
||||
self.unit_price = Uom.compute_price(
|
||||
self.product.default_uom, cost_price, self.uom)
|
||||
self.unit_price_company, unit_price_company = (
|
||||
cost_price, self.unit_price_company)
|
||||
average_cost_price = self._compute_product_cost_price('out')
|
||||
self.unit_price = unit_price
|
||||
self.unit_price_company = unit_price_company
|
||||
|
||||
if cost_price:
|
||||
cost_price = round_price(cost_price)
|
||||
|
||||
+1
-6
@@ -152,12 +152,7 @@ class Product(metaclass=PoolMeta):
|
||||
for move, move_qty in fifo_moves:
|
||||
consumed_qty += move_qty
|
||||
if move.from_location.type in {'supplier', 'production'}:
|
||||
with Transaction().set_context(date=move.effective_date):
|
||||
unit_price = Currency.compute(
|
||||
move.currency, move.unit_price,
|
||||
move.company.currency, round=False)
|
||||
unit_price = Uom.compute_price(
|
||||
move.uom, unit_price, move.product.default_uom)
|
||||
unit_price = move.unit_price_company
|
||||
else:
|
||||
unit_price = move.cost_price or 0
|
||||
cost_price += unit_price * Decimal(str(move_qty))
|
||||
|
||||
Reference in New Issue
Block a user