recompute cost_price in product

This commit is contained in:
Elvis 2023-08-10 17:10:14 -05:00
parent cd483deefd
commit a842ac2346
1 changed files with 3 additions and 0 deletions

View File

@ -89,6 +89,9 @@ class Move(metaclass=PoolMeta):
# remove origin 'stock.inventory.line' for set average cost
if move.origin and move.origin.__name__ in ('purchase.line'):
move.set_average_cost()
if move.product.cost_price_method == 'fixed':
move.product.cost_price = move.unit_price
move.product.save()
def set_average_cost(self):
AverageCost = Pool().get('product.average_cost')