From 43d494fbc4c397e1035cfb635c3c766345cc7c57 Mon Sep 17 00:00:00 2001 From: Suherdy Yacob Date: Fri, 19 Jun 2026 09:40:35 +0700 Subject: [PATCH] refactor: replace deprecated odoo.osv.expression with odoo.fields.Domain for search queries --- models/stock_location.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/models/stock_location.py b/models/stock_location.py index 24d2168..c1f1432 100644 --- a/models/stock_location.py +++ b/models/stock_location.py @@ -1,6 +1,6 @@ import logging from odoo import api, fields, models, _ -from odoo.osv import expression +from odoo.fields import Domain from odoo.tools.float_utils import float_is_zero _logger = logging.getLogger(__name__) @@ -84,7 +84,7 @@ class StockLot(models.Model): quant_domain.append(('product_id', '=', ctx.get('default_product_id'))) quants = self.env['stock.quant'].with_context(skip_location_restriction=True).sudo().search(quant_domain) - domain = expression.AND([domain or [], [('id', 'in', quants.mapped('lot_id').ids)]]) + domain = Domain.AND([domain or [], [('id', 'in', quants.mapped('lot_id').ids)]]) # Use positional/keyword pass-through to match V19 BaseModel return super().name_search(name=name, domain=domain, operator=operator, limit=limit) @@ -101,5 +101,5 @@ class StockLot(models.Model): quant_domain.append(('product_id', '=', ctx.get('default_product_id'))) quants = self.env['stock.quant'].with_context(skip_location_restriction=True).sudo().search(quant_domain) - domain = expression.AND([domain, [('id', 'in', quants.mapped('lot_id').ids)]]) + domain = Domain.AND([domain, [('id', 'in', quants.mapped('lot_id').ids)]]) return super().web_search_read(domain, specification, offset=offset, limit=limit, order=order, count_limit=count_limit)