changeset ea82b7ca5eb1 in modules/product_cost_fifo:default
details:
https://hg.tryton.org/modules/product_cost_fifo?cmd=changeset;node=ea82b7ca5eb1
description:
Use current cost price if no FIFO moves
If we can not find any FIFO moves, the products should be moved out at
the
average cost price instead of zero.
issue8699
review252351002
diffstat:
move.py | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diffs (25 lines):
diff -r b595cff162c5 -r ea82b7ca5eb1 move.py
--- a/move.py Mon Oct 14 00:04:14 2019 +0200
+++ b/move.py Thu Oct 24 18:57:55 2019 +0200
@@ -98,8 +98,11 @@
# TODO save in do method when product change
self.__class__.save(to_save)
- if Decimal(str(consumed_qty)) != Decimal("0"):
+ if consumed_qty:
cost_price = cost_price / Decimal(str(consumed_qty))
+ else:
+ cost_price = self.product.get_multivalue(
+ 'cost_price', **self._cost_price_pattern)
# Compute average cost price
unit_price = self.unit_price
@@ -108,7 +111,7 @@
average_cost_price = self._compute_product_cost_price('out')
self.unit_price = unit_price
- if cost_price != Decimal("0"):
+ if cost_price:
digits = self.__class__.cost_price.digits
cost_price = cost_price.quantize(
Decimal(str(10.0 ** -digits[1])))