summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authorXavier Morel <xmo@odoo.com>2020-06-16 13:57:04 +0000
committerXavier Morel <xmo@odoo.com>2020-06-17 11:19:27 +0000
commit5f310366a099e846066ba3190e2b42daa04e165b (patch)
tree2080462ef0648e225b0b1ae423bfe24abdf3b01b /addons
parentb27f995089f9a9a1cf0cd8909527f6aa8a7ef425 (diff)
[IMP] base, sms, mail: make server action runners not public
There is no reason to call these directly, in fact it's not really possible to do so as they expect an `action` object as first parameter. * warn against the presence of rpc-public runners * move runner selection outside of ``run`` * improve doc a bit maybe
Diffstat (limited to 'addons')
-rw-r--r--addons/mail/models/ir_actions.py9
-rw-r--r--addons/sms/models/ir_actions.py3
-rw-r--r--addons/website/models/ir_actions.py4
3 files changed, 6 insertions, 10 deletions
diff --git a/addons/mail/models/ir_actions.py b/addons/mail/models/ir_actions.py
index 9156baf136c..9ed73296701 100644
--- a/addons/mail/models/ir_actions.py
+++ b/addons/mail/models/ir_actions.py
@@ -63,8 +63,7 @@ class ServerActions(models.Model):
if action.state == 'next_activity' and not action.model_id.is_mail_thread:
raise ValidationError(_("A next activity can only be planned on models that use the chatter"))
- @api.model
- def run_action_followers_multi(self, action, eval_context=None):
+ def _run_action_followers_multi(self, action, eval_context=None):
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')))
@@ -98,8 +97,7 @@ class ServerActions(models.Model):
return True
return False
- @api.model
- def run_action_email(self, action, eval_context=None):
+ def _run_action_email(self, action, eval_context=None):
# TDE CLEANME: when going to new api with server action, remove action
if not action.template_id or not self._context.get('active_id') or self._is_recompute(action):
return False
@@ -111,8 +109,7 @@ class ServerActions(models.Model):
action.template_id.with_context(cleaned_ctx).send_mail(self._context.get('active_id'), force_send=False, raise_exception=False)
return False
- @api.model
- def run_action_next_activity(self, action, eval_context=None):
+ def _run_action_next_activity(self, action, eval_context=None):
if not action.activity_type_id or not self._context.get('active_id') or self._is_recompute(action):
return False
diff --git a/addons/sms/models/ir_actions.py b/addons/sms/models/ir_actions.py
index e5421d4546c..dddaa885d74 100644
--- a/addons/sms/models/ir_actions.py
+++ b/addons/sms/models/ir_actions.py
@@ -26,8 +26,7 @@ class ServerActions(models.Model):
if action.state == 'sms' and not action.model_id.is_mail_thread:
raise ValidationError(_("Sending SMS can only be done on a mail.thread model"))
- @api.model
- def run_action_sms_multi(self, action, eval_context=None):
+ def _run_action_sms_multi(self, action, eval_context=None):
# TDE CLEANME: when going to new api with server action, remove action
if not action.sms_template_id or self._is_recompute(action):
return False
diff --git a/addons/website/models/ir_actions.py b/addons/website/models/ir_actions.py
index e83426b2fef..7e795efe5a8 100644
--- a/addons/website/models/ir_actions.py
+++ b/addons/website/models/ir_actions.py
@@ -51,10 +51,10 @@ class ServerAction(models.Model):
return eval_context
@api.model
- def run_action_code_multi(self, action, eval_context=None):
+ def _run_action_code_multi(self, action, eval_context=None):
""" Override to allow returning response the same way action is already
returned by the basic server action behavior. Note that response has
priority over action, avoid using both.
"""
- res = super(ServerAction, self).run_action_code_multi(action, eval_context)
+ res = super(ServerAction, self)._run_action_code_multi(action, eval_context)
return eval_context.get('response', res)