From 4adfeecdcf7c5e6181338f9be9e1e2d3be00a16e Mon Sep 17 00:00:00 2001 From: Arnold Moyaux Date: Wed, 31 Aug 2022 15:21:25 +0000 Subject: [PATCH] [IMP] stock_account: check if standard price before computation Quick win in standard price. First check if we are in standard before computing the price unit. If not do the standard process. Part-of: odoo/odoo#99411 --- addons/stock_account/models/stock_move.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/stock_account/models/stock_move.py b/addons/stock_account/models/stock_move.py index 32b71da0617..c75bf530ac6 100644 --- a/addons/stock_account/models/stock_move.py +++ b/addons/stock_account/models/stock_move.py @@ -360,9 +360,9 @@ class StockMove(models.Model): valued_quantity = 0 for valued_move_line in valued_move_lines: valued_quantity += valued_move_line.product_uom_id._compute_quantity(valued_move_line.qty_done, move.product_id.uom_id) - unit_cost = abs(move._get_price_unit()) # May be negative (i.e. decrease an out move). - if move.product_id.cost_method == 'standard': - unit_cost = move.product_id.standard_price + unit_cost = move.product_id.standard_price + if move.product_id.cost_method != 'standard': + unit_cost = abs(move._get_price_unit()) # May be negative (i.e. decrease an out move). svl_vals = move.product_id._prepare_in_svl_vals(forced_quantity or valued_quantity, unit_cost) svl_vals.update(move._prepare_common_svl_vals()) if forced_quantity: