diff --git a/addons/point_of_sale/models/pos_session.py b/addons/point_of_sale/models/pos_session.py index 4e6580e3b74..0bebe549f71 100644 --- a/addons/point_of_sale/models/pos_session.py +++ b/addons/point_of_sale/models/pos_session.py @@ -757,7 +757,7 @@ class PosSession(models.Model): for move in stock_moves: exp_key = move.product_id._get_product_accounts()['expense'] out_key = move.product_id.categ_id.property_stock_account_output_categ_id - amount = -sum(move.sudo().stock_valuation_layer_ids.mapped('value')) + amount = move.product_qty * move.product_id._compute_average_price(0, move.product_qty, move) stock_expense[exp_key] = self._update_amounts(stock_expense[exp_key], {'amount': amount}, move.picking_id.date, force_company_currency=True) if move.location_id.usage == 'customer': stock_return[out_key] = self._update_amounts(stock_return[out_key], {'amount': amount}, move.picking_id.date, force_company_currency=True) @@ -783,7 +783,7 @@ class PosSession(models.Model): for move in stock_moves: exp_key = move.product_id._get_product_accounts()['expense'] out_key = move.product_id.categ_id.property_stock_account_output_categ_id - amount = -sum(move.stock_valuation_layer_ids.mapped('value')) + amount = move.product_qty * move.product_id._compute_average_price(0, move.product_qty, move) stock_expense[exp_key] = self._update_amounts(stock_expense[exp_key], {'amount': amount}, move.picking_id.date, force_company_currency=True) if move.location_id.usage == 'customer': stock_return[out_key] = self._update_amounts(stock_return[out_key], {'amount': amount}, move.picking_id.date, force_company_currency=True)