Skip to content

Commit

Permalink
[FIX] cetmix_tower_server: Transaltion format
Browse files Browse the repository at this point in the history
  • Loading branch information
GabbasovDinar committed Jan 16, 2025
1 parent 016312e commit 042d18f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
23 changes: 12 additions & 11 deletions cetmix_tower_server/models/cx_tower_server_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ def create_server_from_template(self, template_reference, server_name, **kwargs)
`variable_reference`: `variable_value_char`
eg:
{'branch': 'prod', 'odoo_version': '16.0'}
with_template_variables (bool): This parameter ensures that the server
pick_all_template_variables (bool): This parameter ensures that the server
being created considers existing variables from the template.
If enabled, the template variables will also be included in the server
variables. The default value is True.
Expand Down Expand Up @@ -203,7 +203,7 @@ def _create_new_server(self, name, **kwargs):
`variable_reference`: `variable_value_char`
eg:
{'branch': 'prod', 'odoo_version': '16.0'}
with_template_variables (bool): This parameter ensures that the server
pick_all_template_variables (bool): This parameter ensures that the server
being created considers existing variables from the template.
If enabled, the template variables will also be included in the server
variables. The default value is True.
Expand Down Expand Up @@ -259,7 +259,7 @@ def _get_fields_tower_server(self):
"server_log_ids",
]

def _prepare_server_values(self, with_template_variables=True, **kwargs):
def _prepare_server_values(self, pick_all_template_variables=True, **kwargs):
"""
Prepare the server values to create a new server based on
the current template. It reads all fields from the template, copies them,
Expand All @@ -268,7 +268,7 @@ def _prepare_server_values(self, with_template_variables=True, **kwargs):
data.
Args:
with_template_variables (bool): This parameter ensures that the server
pick_all_template_variables (bool): This parameter ensures that the server
being created considers existing variables from the template.
If enabled, the template variables will also be included in the server
variables. The default value is True.
Expand Down Expand Up @@ -343,16 +343,17 @@ def _prepare_server_values(self, with_template_variables=True, **kwargs):
detailed_message = "\n".join(
_(
"Variable reference '%(var_ref)s' has an invalid "
"option reference '%(opt_ref)s'."
"option reference '%(opt_ref)s'.",
var_ref=var_ref,
opt_ref=opt_ref,
)
% {"var_ref": var_ref, "opt_ref": opt_ref}
for var_ref, opt_ref in missing_options_to_variables.items()
)
raise ValidationError(
_("Some variable options are invalid:\n%(detailed_message)s")
% {
"detailed_message": detailed_message,
}
_(
"Some variable options are invalid:\n%(detailed_message)s",
detailed_message=detailed_message,
)
)

# Map variable options to their IDs.
Expand Down Expand Up @@ -403,7 +404,7 @@ def _prepare_server_values(self, with_template_variables=True, **kwargs):
)
)

if with_template_variables:
if pick_all_template_variables:
# update or add variable values
existing_variable_values = values.get("variable_value_ids", [])
variable_id_to_index = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def action_confirm(self):

kwargs = self._prepare_server_parameters()
server = self.server_template_id._create_new_server(
self.name, with_template_variables=False, **kwargs
self.name, pick_all_template_variables=False, **kwargs
)
action = self.env["ir.actions.actions"]._for_xml_id(
"cetmix_tower_server.action_cx_tower_server"
Expand Down

0 comments on commit 042d18f

Please sign in to comment.