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

Module: Automation Rules

Entity: ir.actions.server

Compute Method: _compute_name

View 18.0
Inputs Method Outputs
  • state
  • evaluation_type
  • crud_model_id
  • crud_model_id.name
  • value
  • sms_template_id
  • sms_template_id.name
  • template_id
  • template_id.name
  • partner_ids
  • activity_summary
  • activity_type_id
  • activity_type_id.name
  • name
- ''' Only server actions linked to a base_automation get an automatic name. '''
- to_update = self.filtered('base_automation_id')
- for action in to_update:
-             match action.state:
-                 case 'object_write':
-                     action_type = _("Update") if action.evaluation_type == 'value' else _("Compute")
-                     action.name = f"{action_type} {action._stringify_path()}"
-                 case 'object_create':
-                     action.name = _(
-                     "Create %(model_name)s with name %(value)s",
-                         model_name=action.crud_model_id.name,
-                         value=action.value
-                     )
-                 case 'webhook':
-                     action.name = _("Send Webhook Notification")
-                 case 'sms':
-                     action.name = _(
-                     'Send SMS: %(template_name)s',
-                     template_name=action.sms_template_id.name
-                 )
-                 case 'mail_post':
-                     action.name = _(
-                         'Send email: %(template_name)s',
-                         template_name=action.template_id.name
-                     )
-                 case 'followers':
-                     action.name = _(
-                         'Add followers: %(partner_names)s',
-                         partner_names=', '.join(action.partner_ids.mapped('name'))
-                     )
-                 case 'remove_followers':
-                     action.name = _(
-                         'Remove followers: %(partner_names)s',
-                         partner_names=', '.join(action.partner_ids.mapped('name'))
-                     )
-                 case 'next_activity':
-                     action.name = _(
-                         'Create activity: %(activity_name)s',
-                         activity_name=action.activity_summary or action.activity_type_id.name
-                     )
-                 case other:
-                     action.name = dict(action._fields['state']._description_selection(self.env))[action.state]
- for action in (self - to_update):
-             action.name = action.name or ''
  • name

Back to entity