changeset 9b8762ea2346 in modules/product_cost_fifo:default
details:
https://hg.tryton.org/modules/product_cost_fifo?cmd=changeset;node=9b8762ea2346
description:
Add unit_price_company Function field on stock move
issue9401
review290341002
diffstat:
move.py | 7 +++----
product.py | 7 +------
2 files changed, 4 insertions(+), 10 deletions(-)
diffs (35 lines):
diff -r b32e91c7149e -r 9b8762ea2346 move.py
--- a/move.py Fri Jul 03 21:22:43 2020 +0200
+++ b/move.py Sat Jul 04 00:21:39 2020 +0200
@@ -107,11 +107,10 @@
'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)
diff -r b32e91c7149e -r 9b8762ea2346 product.py
--- a/product.py Fri Jul 03 21:22:43 2020 +0200
+++ b/product.py Sat Jul 04 00:21:39 2020 +0200
@@ -152,12 +152,7 @@
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))