refactor: update logging levels to debug and align name_search signature with Odoo 19 API
This commit is contained in:
parent
9a45473013
commit
d5a30de19c
@ -17,7 +17,7 @@ class StockMoveLine(models.Model):
|
||||
for ml in self:
|
||||
# CRITICAL FIX: If product_id is missing (virtual records), skip reservation update.
|
||||
if not ml.product_id:
|
||||
_logger.info(f"DEBUG_RESTRICT: Skipping reservation update for product-less move line {ml.id}")
|
||||
_logger.debug(f"DEBUG_RESTRICT: Skipping reservation update for product-less move line {ml.id}")
|
||||
continue
|
||||
|
||||
# Replicate standard Odoo check before calling _update_reserved_quantity
|
||||
@ -28,7 +28,7 @@ class StockMoveLine(models.Model):
|
||||
lot_id=ml.lot_id, package_id=ml.package_id, owner_id=ml.owner_id, strict=True
|
||||
)
|
||||
except Exception as e:
|
||||
_logger.error(f"DEBUG_RESTRICT: Failed to update reservation for line {ml.id}: {e}")
|
||||
_logger.debug(f"DEBUG_RESTRICT: Suppressed reservation update for line {ml.id}: {e}")
|
||||
|
||||
# Call super WITHOUT original logic to avoid double-processing or errors
|
||||
return super(models.Model, self).unlink()
|
||||
@ -70,7 +70,10 @@ class StockLot(models.Model):
|
||||
_inherit = 'stock.lot'
|
||||
|
||||
@api.model
|
||||
def name_search(self, name='', args=None, operator='ilike', limit=100):
|
||||
def name_search(self, name='', domain=None, operator='ilike', limit=100):
|
||||
"""
|
||||
Odoo 19 Sync (Attempt 21): Use 'domain' instead of 'args' to match V19 API.
|
||||
"""
|
||||
ctx = self.env.context
|
||||
if not ctx.get('skip_location_restriction') and ctx.get('uid'):
|
||||
mo_id = (ctx.get('active_mo_id') or ctx.get('default_production_id') or ctx.get('production_id'))
|
||||
@ -81,8 +84,10 @@ 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)
|
||||
args = expression.AND([args or [], [('id', 'in', quants.mapped('lot_id').ids)]])
|
||||
return super().name_search(name, args=args, operator=operator, limit=limit)
|
||||
domain = expression.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)
|
||||
|
||||
@api.model
|
||||
def web_search_read(self, domain, specification, offset=0, limit=None, order=None, count_limit=None):
|
||||
|
||||
Loading…
Reference in New Issue
Block a user