diff --git a/fieldservice_stage_validation/models/validate_utils.py b/fieldservice_stage_validation/models/validate_utils.py index c9a8ff82fe..5725fee380 100644 --- a/fieldservice_stage_validation/models/validate_utils.py +++ b/fieldservice_stage_validation/models/validate_utils.py @@ -14,10 +14,13 @@ def validate_stage_fields(records): for name in field_names: if not values[0][name]: lang_context = {"lang": records.env.context.get("lang", "en_US")} - user_model = records.env["res.users"].with_context(**lang_context) + # Asignar el contexto directamente a res.users + records.env.context = records.env.context.copy() # Asegurar que se copie el contexto + records.env.context.update(lang_context) + # Usar _() directamente para la traducción raise ValidationError( - user_model._( + _( "Cannot move to stage %(stage_name)s " "until the %(name)s field is set.", stage_name=stage.name,