Odoo Mindscape. Understand Odoo faster. Explore modules, fields, dependencies and version differences in one place instead of digging through the source code.

Module: Base

Entity: ir.actions.server

Compute Method: _compute_value_field_to_show

View 19.0 View 20.0
Inputs Method Outputs
  • evaluation_type
  • update_field_id
  • update_field_id.ttype
  • update_property
  • crud_model_name
  • update_field_id.name
+ def _get_value_field_to_show(field_type):
+             if field_type in ('one2many', 'many2many'):
+                 return 'x2many'
+             elif field_type == 'many2one':
+                 return 'resource_ref'
+             elif field_type == 'selection':
+                 return 'selection_value'
+             elif field_type == 'boolean':
+                 return 'update_boolean_value'
+             elif field_type == 'html':
+                 return 'html_value'
+             else:
+                 return 'value'
for action in self:
            if action.evaluation_type == 'sequence':
                action.value_field_to_show = 'sequence_id'
-             elif action.update_field_id.ttype in ('one2many', 'many2one', 'many2many'):
-                 action.value_field_to_show = 'resource_ref'
-             elif action.update_field_id.ttype == 'selection':
-                 action.value_field_to_show = 'selection_value'
-             elif action.update_field_id.ttype == 'boolean':
-                 action.value_field_to_show = 'update_boolean_value'
-             elif action.update_field_id.ttype == 'html':
-                 action.value_field_to_show = 'html_value'
+             elif action.update_field_id.ttype == 'properties':
+                 if not action.update_property:
+                     action.value_field_to_show = False
+                     return
+                 virtual = self.env[action.crud_model_name].new()
+                 property_def = virtual.get_property_definition(action.update_field_id.name + "." + action.update_property)
+                 if property_def.get('type') == 'selection':
+                     action.value_field_to_show = 'property_selection'
+                 else:
+                     action.value_field_to_show = _get_value_field_to_show(property_def.get('type'))
            else:
-                 action.value_field_to_show = 'value'
+                 action.value_field_to_show = _get_value_field_to_show(action.update_field_id.ttype)
  • value_field_to_show

Back to entity