From 9cb9e227c9a52b675e69e29540b59bf45523b54c Mon Sep 17 00:00:00 2001 From: "Lucas Perais (lpe)" Date: Tue, 7 May 2019 09:07:20 +0000 Subject: [PATCH] [FIX] mail: ir_action have a stored field containing the model name Make a CRM lead, assign it to a portal user Have an automated action which add followers on create and write From the portal, edit the lead Before this commit, it crashed because a portal user doesn't have access to ir.model (4a18d5744e0a36cb2f120bfad00b52ad22f4d01d) After this commit, the flow works, because we use the stored model name on the action instead of trying to read ir.model OPW 1985570 closes odoo/odoo#33211 Signed-off-by: Christophe Simonis --- addons/mail/models/ir_actions.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/mail/models/ir_actions.py b/addons/mail/models/ir_actions.py index 203304c7fb7..56f60069024 100644 --- a/addons/mail/models/ir_actions.py +++ b/addons/mail/models/ir_actions.py @@ -70,7 +70,7 @@ class ServerActions(models.Model): @api.model def run_action_followers_multi(self, action, eval_context=None): - Model = self.env[action.model_id.model] + Model = self.env[action.model_name] if self.partner_ids or self.channel_ids and hasattr(Model, 'message_subscribe'): records = Model.browse(self._context.get('active_ids', self._context.get('active_id'))) records.message_subscribe(self.partner_ids.ids, self.channel_ids.ids) @@ -83,7 +83,7 @@ class ServerActions(models.Model): When need to know it to skip these steps. Except if the computed field is supposed to trigger the action """ - records = self.env[action.model_id.model].browse( + records = self.env[action.model_name].browse( self._context.get('active_ids', self._context.get('active_id'))) old_values = action._context.get('old_values') if old_values: @@ -121,7 +121,7 @@ class ServerActions(models.Model): if not action.activity_type_id or not self._context.get('active_id') or self._is_recompute(action): return False - records = self.env[action.model_id.model].browse(self._context.get('active_ids', self._context.get('active_id'))) + records = self.env[action.model_name].browse(self._context.get('active_ids', self._context.get('active_id'))) vals = { 'summary': action.activity_summary or '',