diff --git a/addons/stock_account/models/stock_move.py b/addons/stock_account/models/stock_move.py index 2c90c4af584..46cfc895e4a 100644 --- a/addons/stock_account/models/stock_move.py +++ b/addons/stock_account/models/stock_move.py @@ -5,7 +5,7 @@ from collections import defaultdict from odoo import api, fields, models, _ from odoo.exceptions import UserError -from odoo.tools import float_is_zero +from odoo.tools import float_is_zero, OrderedSet import logging _logger = logging.getLogger(__name__) @@ -54,13 +54,13 @@ class StockMove(models.Model): :rtype: recordset """ self.ensure_one() - res = self.env['stock.move.line'] + res = OrderedSet() for move_line in self.move_line_ids: if move_line.owner_id and move_line.owner_id != move_line.company_id.partner_id: continue if not move_line.location_id._should_be_valued() and move_line.location_dest_id._should_be_valued(): - res |= move_line - return res + res.add(move_line.id) + return self.env['stock.move.line'].browse(res) def _is_in(self): """Check if the move should be considered as entering the company so that the cost method