From 75cb0d7a6bbadbef4b133772454be2f33118db7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=80ngel=20=C3=80lvarez?= Date: Thu, 8 Apr 2021 12:11:17 +0200 Subject: [PATCH] Enforce filling cost price of move We set cost price only for outgoing or incoming moves. issue9397 --- move.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/move.py b/move.py index 423a4bd..f4a7b61 100644 --- a/trytond/trytond/modules/product_cost_fifo/move.py +++ b/trytond/trytond/modules/product_cost_fifo/move.py @@ -102,7 +102,7 @@ class Move(metaclass=PoolMeta): # Compute average cost price average_cost_price = self._compute_product_cost_price( 'out', product_cost_price=cost_price) - + if cost_price: digits = self.__class__.cost_price.digits cost_price = cost_price.quantize( @@ -126,7 +126,7 @@ class Move(metaclass=PoolMeta): and self.product.cost_price_method == 'fifo'): fifo_cost_price, cost_price = ( self._update_fifo_out_product_cost_price()) - if self.cost_price is None: + if self.cost_price_required and self.cost_price is None: self.cost_price = fifo_cost_price return cost_price -- 2.25.1