|
@@ -404,6 +404,25 @@ class HelpdeskTeamExtras(models.Model):
|
|
|
if not default_form:
|
|
if not default_form:
|
|
|
return
|
|
return
|
|
|
|
|
|
|
|
|
|
+ # Get website language for translations
|
|
|
|
|
+ # Try to get current website, fallback to default website or system language
|
|
|
|
|
+ website = self.env['website'].get_current_website()
|
|
|
|
|
+ if website:
|
|
|
|
|
+ lang = website.default_lang_id.code if website.default_lang_id else 'en_US'
|
|
|
|
|
+ else:
|
|
|
|
|
+ # Fallback: try to get default website
|
|
|
|
|
+ try:
|
|
|
|
|
+ default_website = self.env.ref('website.default_website', raise_if_not_found=False)
|
|
|
|
|
+ if default_website and default_website.default_lang_id:
|
|
|
|
|
+ lang = default_website.default_lang_id.code
|
|
|
|
|
+ else:
|
|
|
|
|
+ lang = self.env.context.get('lang', 'en_US')
|
|
|
|
|
+ except Exception:
|
|
|
|
|
+ lang = self.env.context.get('lang', 'en_US')
|
|
|
|
|
+
|
|
|
|
|
+ # Create environment with website language for translations
|
|
|
|
|
+ env_lang = self.env(context=dict(self.env.context, lang=lang))
|
|
|
|
|
+
|
|
|
# Get template fields sorted by sequence
|
|
# Get template fields sorted by sequence
|
|
|
template_fields = self.template_id.field_ids.sorted('sequence')
|
|
template_fields = self.template_id.field_ids.sorted('sequence')
|
|
|
|
|
|
|
@@ -466,7 +485,7 @@ class HelpdeskTeamExtras(models.Model):
|
|
|
template_fields_html = []
|
|
template_fields_html = []
|
|
|
for tf in template_fields:
|
|
for tf in template_fields:
|
|
|
try:
|
|
try:
|
|
|
- field_html, field_id_counter = self._build_template_field_html(tf, field_id_counter)
|
|
|
|
|
|
|
+ field_html, field_id_counter = self._build_template_field_html(tf, field_id_counter, env_lang=env_lang)
|
|
|
if field_html:
|
|
if field_html:
|
|
|
template_fields_html.append(field_html)
|
|
template_fields_html.append(field_html)
|
|
|
_logger.info(f"Built HTML for field {tf.field_id.name if tf.field_id else 'Unknown'}")
|
|
_logger.info(f"Built HTML for field {tf.field_id.name if tf.field_id else 'Unknown'}")
|
|
@@ -538,18 +557,19 @@ class HelpdeskTeamExtras(models.Model):
|
|
|
# Restore default arch
|
|
# Restore default arch
|
|
|
self.website_form_view_id.sudo().arch = default_form.arch
|
|
self.website_form_view_id.sudo().arch = default_form.arch
|
|
|
|
|
|
|
|
- def _build_template_field_html(self, template_field, field_id_counter=0):
|
|
|
|
|
|
|
+ def _build_template_field_html(self, template_field, field_id_counter=0, env_lang=None):
|
|
|
"""Build HTML string for a template field exactly as Odoo's form builder does
|
|
"""Build HTML string for a template field exactly as Odoo's form builder does
|
|
|
|
|
|
|
|
Args:
|
|
Args:
|
|
|
template_field: helpdesk.template.field record
|
|
template_field: helpdesk.template.field record
|
|
|
field_id_counter: int, counter for generating unique field IDs (incremented and returned)
|
|
field_id_counter: int, counter for generating unique field IDs (incremented and returned)
|
|
|
|
|
+ env_lang: Environment with language context for translations
|
|
|
|
|
|
|
|
Returns:
|
|
Returns:
|
|
|
tuple: (html_string, updated_counter)
|
|
tuple: (html_string, updated_counter)
|
|
|
"""
|
|
"""
|
|
|
# Build the XML element first using existing method
|
|
# Build the XML element first using existing method
|
|
|
- field_el, field_id_counter = self._build_template_field_xml(template_field, field_id_counter)
|
|
|
|
|
|
|
+ field_el, field_id_counter = self._build_template_field_xml(template_field, field_id_counter, env_lang=env_lang)
|
|
|
if field_el is None:
|
|
if field_el is None:
|
|
|
return None, field_id_counter
|
|
return None, field_id_counter
|
|
|
|
|
|
|
@@ -557,12 +577,13 @@ class HelpdeskTeamExtras(models.Model):
|
|
|
html_str = etree.tostring(field_el, encoding='unicode', pretty_print=True)
|
|
html_str = etree.tostring(field_el, encoding='unicode', pretty_print=True)
|
|
|
return html_str, field_id_counter
|
|
return html_str, field_id_counter
|
|
|
|
|
|
|
|
- def _build_template_field_xml(self, template_field, field_id_counter=0):
|
|
|
|
|
|
|
+ def _build_template_field_xml(self, template_field, field_id_counter=0, env_lang=None):
|
|
|
"""Build XML element for a template field exactly as Odoo's form builder does
|
|
"""Build XML element for a template field exactly as Odoo's form builder does
|
|
|
|
|
|
|
|
Args:
|
|
Args:
|
|
|
template_field: helpdesk.template.field record
|
|
template_field: helpdesk.template.field record
|
|
|
field_id_counter: int, counter for generating unique field IDs (incremented and returned)
|
|
field_id_counter: int, counter for generating unique field IDs (incremented and returned)
|
|
|
|
|
+ env_lang: Environment with language context for translations
|
|
|
|
|
|
|
|
Returns:
|
|
Returns:
|
|
|
tuple: (field_element, updated_counter)
|
|
tuple: (field_element, updated_counter)
|
|
@@ -570,8 +591,32 @@ class HelpdeskTeamExtras(models.Model):
|
|
|
field = template_field.field_id
|
|
field = template_field.field_id
|
|
|
field_name = field.name
|
|
field_name = field.name
|
|
|
field_type = field.ttype
|
|
field_type = field.ttype
|
|
|
- # Use custom label if provided, otherwise use field's default label
|
|
|
|
|
- field_label = template_field.label_custom or field.field_description or field.name
|
|
|
|
|
|
|
+
|
|
|
|
|
+ # Use environment with language context if provided, otherwise use self.env
|
|
|
|
|
+ env = env_lang if env_lang else self.env
|
|
|
|
|
+
|
|
|
|
|
+ # Use custom label if provided, otherwise use field's default label with language context
|
|
|
|
|
+ if template_field.label_custom:
|
|
|
|
|
+ field_label = template_field.label_custom
|
|
|
|
|
+ else:
|
|
|
|
|
+ # Get field description in the correct language using the model's field
|
|
|
|
|
+ model_name = field.model_id.model
|
|
|
|
|
+ try:
|
|
|
|
|
+ model = env[model_name]
|
|
|
|
|
+ model_field = model._fields.get(field_name)
|
|
|
|
|
+ if model_field:
|
|
|
|
|
+ # Use get_description() method which returns translated string
|
|
|
|
|
+ # This method respects the language context
|
|
|
|
|
+ field_desc = model_field.get_description(env)
|
|
|
|
|
+ field_label = field_desc.get('string', '') if isinstance(field_desc, dict) else (field_desc or field.field_description or field.name)
|
|
|
|
|
+ if not field_label:
|
|
|
|
|
+ field_label = field.field_description or field.name
|
|
|
|
|
+ else:
|
|
|
|
|
+ field_label = field.field_description or field.name
|
|
|
|
|
+ except Exception:
|
|
|
|
|
+ # Fallback to field description or name
|
|
|
|
|
+ field_label = field.field_description or field.name
|
|
|
|
|
+
|
|
|
required = template_field.required
|
|
required = template_field.required
|
|
|
sequence = template_field.sequence
|
|
sequence = template_field.sequence
|
|
|
|
|
|
|
@@ -719,20 +764,33 @@ class HelpdeskTeamExtras(models.Model):
|
|
|
if selection_options:
|
|
if selection_options:
|
|
|
options_list = selection_options
|
|
options_list = selection_options
|
|
|
else:
|
|
else:
|
|
|
- # Get from model field definition
|
|
|
|
|
|
|
+ # Get from model field definition with language context
|
|
|
model_name = field.model_id.model
|
|
model_name = field.model_id.model
|
|
|
- model = self.env[model_name]
|
|
|
|
|
|
|
+ model = env[model_name]
|
|
|
options_list = []
|
|
options_list = []
|
|
|
if hasattr(model, field_name):
|
|
if hasattr(model, field_name):
|
|
|
model_field = model._fields.get(field_name)
|
|
model_field = model._fields.get(field_name)
|
|
|
if model_field and hasattr(model_field, 'selection'):
|
|
if model_field and hasattr(model_field, 'selection'):
|
|
|
- selection = model_field.selection
|
|
|
|
|
- if callable(selection):
|
|
|
|
|
- selection = selection(model)
|
|
|
|
|
- if isinstance(selection, (list, tuple)):
|
|
|
|
|
- options_list = selection
|
|
|
|
|
|
|
+ # Use _description_selection method which handles translation correctly
|
|
|
|
|
+ try:
|
|
|
|
|
+ if hasattr(model_field, '_description_selection'):
|
|
|
|
|
+ # This method returns translated options when env has lang context
|
|
|
|
|
+ selection = model_field._description_selection(env)
|
|
|
|
|
+ if isinstance(selection, (list, tuple)):
|
|
|
|
|
+ options_list = selection
|
|
|
|
|
+ else:
|
|
|
|
|
+ # Fallback: use get_field_selection from ir.model.fields
|
|
|
|
|
+ options_list = env['ir.model.fields'].get_field_selection(model_name, field_name)
|
|
|
|
|
+ except Exception:
|
|
|
|
|
+ # Fallback: get selection directly
|
|
|
|
|
+ selection = model_field.selection
|
|
|
|
|
+ if callable(selection):
|
|
|
|
|
+ selection = selection(model)
|
|
|
|
|
+ if isinstance(selection, (list, tuple)):
|
|
|
|
|
+ options_list = selection
|
|
|
elif field.selection:
|
|
elif field.selection:
|
|
|
try:
|
|
try:
|
|
|
|
|
+ # Evaluate selection string if it's stored as string
|
|
|
selection = eval(field.selection) if isinstance(field.selection, str) else field.selection
|
|
selection = eval(field.selection) if isinstance(field.selection, str) else field.selection
|
|
|
if isinstance(selection, (list, tuple)):
|
|
if isinstance(selection, (list, tuple)):
|
|
|
options_list = selection
|
|
options_list = selection
|
|
@@ -771,12 +829,12 @@ class HelpdeskTeamExtras(models.Model):
|
|
|
'data-name': field_name,
|
|
'data-name': field_name,
|
|
|
'data-display': 'horizontal'
|
|
'data-display': 'horizontal'
|
|
|
})
|
|
})
|
|
|
- # Get selection options (same as radio)
|
|
|
|
|
|
|
+ # Get selection options (same as radio) with language context
|
|
|
if selection_options:
|
|
if selection_options:
|
|
|
options_list = selection_options
|
|
options_list = selection_options
|
|
|
else:
|
|
else:
|
|
|
model_name = field.model_id.model
|
|
model_name = field.model_id.model
|
|
|
- model = self.env[model_name]
|
|
|
|
|
|
|
+ model = env[model_name]
|
|
|
options_list = []
|
|
options_list = []
|
|
|
if hasattr(model, field_name):
|
|
if hasattr(model, field_name):
|
|
|
model_field = model._fields.get(field_name)
|
|
model_field = model._fields.get(field_name)
|
|
@@ -831,11 +889,31 @@ class HelpdeskTeamExtras(models.Model):
|
|
|
input_el.set('placeholder', template_field.placeholder)
|
|
input_el.set('placeholder', template_field.placeholder)
|
|
|
if required:
|
|
if required:
|
|
|
input_el.set('required', '1')
|
|
input_el.set('required', '1')
|
|
|
- # Add default option
|
|
|
|
|
|
|
+ # Add default option - translate using website language context
|
|
|
default_option = etree.SubElement(input_el, 'option', {
|
|
default_option = etree.SubElement(input_el, 'option', {
|
|
|
'value': ''
|
|
'value': ''
|
|
|
})
|
|
})
|
|
|
- default_option.text = '-- Select --'
|
|
|
|
|
|
|
+ # Get translation using the environment's language context
|
|
|
|
|
+ # Load translations explicitly and get translated text
|
|
|
|
|
+ lang = env.lang or 'en_US'
|
|
|
|
|
+ try:
|
|
|
|
|
+ from odoo.tools.translate import get_translation, code_translations
|
|
|
|
|
+ # Force load translations by accessing them (this triggers _load_python_translations)
|
|
|
|
|
+ translations = code_translations.get_python_translations('helpdesk_extras', lang)
|
|
|
|
|
+ translated_text = get_translation('helpdesk_extras', lang, '-- Select --', ())
|
|
|
|
|
+ # If translation is the same as source, it means translation not found or not loaded
|
|
|
|
|
+ if translated_text == '-- Select --' and lang != 'en_US':
|
|
|
|
|
+ # Check if translation exists in loaded translations
|
|
|
|
|
+ translated_text = translations.get('-- Select --', '-- Select --')
|
|
|
|
|
+ default_option.text = translated_text
|
|
|
|
|
+ except Exception:
|
|
|
|
|
+ # Fallback: use direct translation mapping based on language
|
|
|
|
|
+ translations_map = {
|
|
|
|
|
+ 'es_MX': '-- Seleccionar --',
|
|
|
|
|
+ 'es_ES': '-- Seleccionar --',
|
|
|
|
|
+ 'es': '-- Seleccionar --',
|
|
|
|
|
+ }
|
|
|
|
|
+ default_option.text = translations_map.get(lang, '-- Select --')
|
|
|
|
|
|
|
|
# Populate selection options
|
|
# Populate selection options
|
|
|
if selection_options:
|
|
if selection_options:
|
|
@@ -848,25 +926,52 @@ class HelpdeskTeamExtras(models.Model):
|
|
|
if template_field.default_value and str(template_field.default_value) == str(option_value):
|
|
if template_field.default_value and str(template_field.default_value) == str(option_value):
|
|
|
option.set('selected', 'selected')
|
|
option.set('selected', 'selected')
|
|
|
else:
|
|
else:
|
|
|
- # Get from model field definition
|
|
|
|
|
|
|
+ # Get from model field definition with language context
|
|
|
model_name = field.model_id.model
|
|
model_name = field.model_id.model
|
|
|
- model = self.env[model_name]
|
|
|
|
|
|
|
+ model = env[model_name]
|
|
|
if hasattr(model, field_name):
|
|
if hasattr(model, field_name):
|
|
|
model_field = model._fields.get(field_name)
|
|
model_field = model._fields.get(field_name)
|
|
|
if model_field and hasattr(model_field, 'selection'):
|
|
if model_field and hasattr(model_field, 'selection'):
|
|
|
- selection = model_field.selection
|
|
|
|
|
- if callable(selection):
|
|
|
|
|
- selection = selection(model)
|
|
|
|
|
- if isinstance(selection, (list, tuple)):
|
|
|
|
|
- for option_value, option_label in selection:
|
|
|
|
|
- option = etree.SubElement(input_el, 'option', {
|
|
|
|
|
- 'value': str(option_value)
|
|
|
|
|
- })
|
|
|
|
|
- option.text = option_label
|
|
|
|
|
- if template_field.default_value and str(template_field.default_value) == str(option_value):
|
|
|
|
|
- option.set('selected', 'selected')
|
|
|
|
|
|
|
+ # Use _description_selection method which handles translation correctly
|
|
|
|
|
+ try:
|
|
|
|
|
+ if hasattr(model_field, '_description_selection'):
|
|
|
|
|
+ # This method returns translated options when env has lang context
|
|
|
|
|
+ selection = model_field._description_selection(env)
|
|
|
|
|
+ if isinstance(selection, (list, tuple)):
|
|
|
|
|
+ for option_value, option_label in selection:
|
|
|
|
|
+ option = etree.SubElement(input_el, 'option', {
|
|
|
|
|
+ 'value': str(option_value)
|
|
|
|
|
+ })
|
|
|
|
|
+ option.text = option_label
|
|
|
|
|
+ if template_field.default_value and str(template_field.default_value) == str(option_value):
|
|
|
|
|
+ option.set('selected', 'selected')
|
|
|
|
|
+ else:
|
|
|
|
|
+ # Fallback: use get_field_selection from ir.model.fields
|
|
|
|
|
+ selection = env['ir.model.fields'].get_field_selection(model_name, field_name)
|
|
|
|
|
+ if isinstance(selection, (list, tuple)):
|
|
|
|
|
+ for option_value, option_label in selection:
|
|
|
|
|
+ option = etree.SubElement(input_el, 'option', {
|
|
|
|
|
+ 'value': str(option_value)
|
|
|
|
|
+ })
|
|
|
|
|
+ option.text = option_label
|
|
|
|
|
+ if template_field.default_value and str(template_field.default_value) == str(option_value):
|
|
|
|
|
+ option.set('selected', 'selected')
|
|
|
|
|
+ except Exception:
|
|
|
|
|
+ # Fallback: get selection directly
|
|
|
|
|
+ selection = model_field.selection
|
|
|
|
|
+ if callable(selection):
|
|
|
|
|
+ selection = selection(model)
|
|
|
|
|
+ if isinstance(selection, (list, tuple)):
|
|
|
|
|
+ for option_value, option_label in selection:
|
|
|
|
|
+ option = etree.SubElement(input_el, 'option', {
|
|
|
|
|
+ 'value': str(option_value)
|
|
|
|
|
+ })
|
|
|
|
|
+ option.text = option_label
|
|
|
|
|
+ if template_field.default_value and str(template_field.default_value) == str(option_value):
|
|
|
|
|
+ option.set('selected', 'selected')
|
|
|
elif field.selection:
|
|
elif field.selection:
|
|
|
try:
|
|
try:
|
|
|
|
|
+ # Evaluate selection string if it's stored as string
|
|
|
selection = eval(field.selection) if isinstance(field.selection, str) else field.selection
|
|
selection = eval(field.selection) if isinstance(field.selection, str) else field.selection
|
|
|
if isinstance(selection, (list, tuple)):
|
|
if isinstance(selection, (list, tuple)):
|
|
|
for option_value, option_label in selection:
|
|
for option_value, option_label in selection:
|
|
@@ -908,11 +1013,11 @@ class HelpdeskTeamExtras(models.Model):
|
|
|
'data-name': field_name,
|
|
'data-name': field_name,
|
|
|
'data-display': 'horizontal'
|
|
'data-display': 'horizontal'
|
|
|
})
|
|
})
|
|
|
- # Load records from relation
|
|
|
|
|
|
|
+ # Load records from relation with language context
|
|
|
relation = field.relation
|
|
relation = field.relation
|
|
|
if relation and relation != 'ir.attachment':
|
|
if relation and relation != 'ir.attachment':
|
|
|
try:
|
|
try:
|
|
|
- records = self.env[relation].sudo().search_read(
|
|
|
|
|
|
|
+ records = env[relation].sudo().search_read(
|
|
|
[], ['display_name'], limit=1000
|
|
[], ['display_name'], limit=1000
|
|
|
)
|
|
)
|
|
|
for record in records:
|
|
for record in records:
|
|
@@ -951,7 +1056,7 @@ class HelpdeskTeamExtras(models.Model):
|
|
|
relation = field.relation
|
|
relation = field.relation
|
|
|
if relation and relation != 'ir.attachment':
|
|
if relation and relation != 'ir.attachment':
|
|
|
try:
|
|
try:
|
|
|
- records = self.env[relation].sudo().search_read(
|
|
|
|
|
|
|
+ records = env[relation].sudo().search_read(
|
|
|
[], ['display_name'], limit=1000
|
|
[], ['display_name'], limit=1000
|
|
|
)
|
|
)
|
|
|
default_values = template_field.default_value.split(',') if template_field.default_value else []
|
|
default_values = template_field.default_value.split(',') if template_field.default_value else []
|
|
@@ -993,16 +1098,36 @@ class HelpdeskTeamExtras(models.Model):
|
|
|
if required:
|
|
if required:
|
|
|
input_el.set('required', '1')
|
|
input_el.set('required', '1')
|
|
|
|
|
|
|
|
- # Add default option
|
|
|
|
|
|
|
+ # Add default option - translate using website language context
|
|
|
default_option = etree.SubElement(input_el, 'option', {'value': ''})
|
|
default_option = etree.SubElement(input_el, 'option', {'value': ''})
|
|
|
- default_option.text = '-- Select --'
|
|
|
|
|
|
|
+ # Get translation using the environment's language context
|
|
|
|
|
+ # Load translations explicitly and get translated text
|
|
|
|
|
+ lang = env.lang or 'en_US'
|
|
|
|
|
+ try:
|
|
|
|
|
+ from odoo.tools.translate import get_translation, code_translations
|
|
|
|
|
+ # Force load translations by accessing them (this triggers _load_python_translations)
|
|
|
|
|
+ translations = code_translations.get_python_translations('helpdesk_extras', lang)
|
|
|
|
|
+ translated_text = get_translation('helpdesk_extras', lang, '-- Select --', ())
|
|
|
|
|
+ # If translation is the same as source, it means translation not found or not loaded
|
|
|
|
|
+ if translated_text == '-- Select --' and lang != 'en_US':
|
|
|
|
|
+ # Check if translation exists in loaded translations
|
|
|
|
|
+ translated_text = translations.get('-- Select --', '-- Select --')
|
|
|
|
|
+ default_option.text = translated_text
|
|
|
|
|
+ except Exception:
|
|
|
|
|
+ # Fallback: use direct translation mapping based on language
|
|
|
|
|
+ translations_map = {
|
|
|
|
|
+ 'es_MX': '-- Seleccionar --',
|
|
|
|
|
+ 'es_ES': '-- Seleccionar --',
|
|
|
|
|
+ 'es': '-- Seleccionar --',
|
|
|
|
|
+ }
|
|
|
|
|
+ default_option.text = translations_map.get(lang, '-- Select --')
|
|
|
|
|
|
|
|
- # Load records dynamically from relation
|
|
|
|
|
|
|
+ # Load records dynamically from relation with language context
|
|
|
relation = field.relation
|
|
relation = field.relation
|
|
|
if relation and relation != 'ir.attachment':
|
|
if relation and relation != 'ir.attachment':
|
|
|
try:
|
|
try:
|
|
|
- # Try to get records from the relation model
|
|
|
|
|
- records = self.env[relation].sudo().search_read(
|
|
|
|
|
|
|
+ # Try to get records from the relation model with language context
|
|
|
|
|
+ records = env[relation].sudo().search_read(
|
|
|
[], ['display_name'], limit=1000
|
|
[], ['display_name'], limit=1000
|
|
|
)
|
|
)
|
|
|
for record in records:
|
|
for record in records:
|
|
@@ -1013,16 +1138,16 @@ class HelpdeskTeamExtras(models.Model):
|
|
|
if template_field.default_value and str(template_field.default_value) == str(record['id']):
|
|
if template_field.default_value and str(template_field.default_value) == str(record['id']):
|
|
|
option.set('selected', 'selected')
|
|
option.set('selected', 'selected')
|
|
|
except Exception:
|
|
except Exception:
|
|
|
- # If relation doesn't exist or access denied, try specific cases
|
|
|
|
|
|
|
+ # If relation doesn't exist or access denied, try specific cases with language context
|
|
|
if field_name == 'request_type_id':
|
|
if field_name == 'request_type_id':
|
|
|
- request_types = self.env['helpdesk.request.type'].sudo().search([('active', '=', True)])
|
|
|
|
|
|
|
+ request_types = env['helpdesk.request.type'].sudo().search([('active', '=', True)])
|
|
|
for req_type in request_types:
|
|
for req_type in request_types:
|
|
|
option = etree.SubElement(input_el, 'option', {
|
|
option = etree.SubElement(input_el, 'option', {
|
|
|
'value': str(req_type.id)
|
|
'value': str(req_type.id)
|
|
|
})
|
|
})
|
|
|
option.text = req_type.name
|
|
option.text = req_type.name
|
|
|
elif field_name == 'affected_module_id':
|
|
elif field_name == 'affected_module_id':
|
|
|
- modules = self.env['helpdesk.affected.module'].sudo().search([
|
|
|
|
|
|
|
+ modules = env['helpdesk.affected.module'].sudo().search([
|
|
|
('active', '=', True)
|
|
('active', '=', True)
|
|
|
], order='name')
|
|
], order='name')
|
|
|
for module in modules:
|
|
for module in modules:
|
|
@@ -1082,11 +1207,11 @@ class HelpdeskTeamExtras(models.Model):
|
|
|
'data-name': field_name,
|
|
'data-name': field_name,
|
|
|
'data-display': 'horizontal'
|
|
'data-display': 'horizontal'
|
|
|
})
|
|
})
|
|
|
- # Try to load records from relation
|
|
|
|
|
|
|
+ # Try to load records from relation with language context
|
|
|
relation = field.relation
|
|
relation = field.relation
|
|
|
if relation:
|
|
if relation:
|
|
|
try:
|
|
try:
|
|
|
- records = self.env[relation].sudo().search_read(
|
|
|
|
|
|
|
+ records = env[relation].sudo().search_read(
|
|
|
[], ['display_name'], limit=100
|
|
[], ['display_name'], limit=100
|
|
|
)
|
|
)
|
|
|
for record in records:
|
|
for record in records:
|