diff --git a/addons/repair/models/repair.py b/addons/repair/models/repair.py index 093678ef8e0..aee645ac0e1 100644 --- a/addons/repair/models/repair.py +++ b/addons/repair/models/repair.py @@ -652,9 +652,14 @@ class RepairLine(models.Model): help='The status of a repair line is set automatically to the one of the linked repair order.') @api.constrains('lot_id', 'product_id') - def constrain_lot_id(self): - for line in self.filtered(lambda x: x.product_id.tracking != 'none' and not x.lot_id): - raise ValidationError(_("Serial number is required for operation line with product '%s'") % (line.product_id.name)) + def _check_product_tracking(self): + invalid_lines = self.filtered(lambda x: x.product_id.tracking != 'none' and not x.lot_id) + if invalid_lines: + products = invalid_lines.product_id + raise ValidationError(_( + "Serial number is required for operation lines with products: %s", + ", ".join(products.mapped('name')), + )) @api.depends('price_unit', 'repair_id', 'product_uom_qty', 'product_id', 'repair_id.invoice_method') def _compute_price_subtotal(self):