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

Module: Discuss

Entity: ir.actions.server

Compute Method: _compute_followers_info

View 17.0 View 20.0
Inputs Method Outputs
  • followers_type
  • model_id
  • model_id.model
- to_reset = self.filtered(lambda act: act.state != 'followers')
- if to_reset:
-             to_reset.partner_ids = False
+ for action in self:
+             if action.followers_type == 'specific':
+                 action.followers_partner_field_name = False
+             elif action.followers_type == 'generic':
+                 action.partner_ids = False
+                 IrModelFields = self.env['ir.model.fields']
+                 domain = [('model', '=', action.model_id.model), ("relation", "=", "res.partner")]
+                 action.followers_partner_field_name = (
+                     IrModelFields.search([*domain, ("name", "=", "partner_id")], limit=1)
+                     or IrModelFields.search(domain, limit=1)
+                 ).name
+             else:
+                 action.partner_ids = False
+                 action.followers_partner_field_name = False
  • followers_partner_field_name
  • partner_ids

Back to entity