diff options
| author | Martin Trigaux <mat@odoo.com> | 2020-05-25 07:04:52 +0000 |
|---|---|---|
| committer | Martin Trigaux <mat@odoo.com> | 2020-08-17 09:09:02 +0000 |
| commit | 6156f98288b16f6c84d36bacf16d5a66a661abb3 (patch) | |
| tree | 7a760d990d660640fed108a5d1fb5c8ce62a52e5 /addons/base_automation | |
| parent | d5c16492397047ceb97a0879aa61f068a0eeeca8 (diff) | |
[FIX] *: adapt action content retrieval
Use _for_xml_id to replace all the self.env.ref().read()[0]
This has the advantage of having a single point of control and to add
the fields filtering and model verification.
Add sudo for other operations on ir.actions.*
Diffstat (limited to 'addons/base_automation')
| -rw-r--r-- | addons/base_automation/models/base_automation.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/addons/base_automation/models/base_automation.py b/addons/base_automation/models/base_automation.py index 77be0ddc76d..e5ef6cf2f16 100644 --- a/addons/base_automation/models/base_automation.py +++ b/addons/base_automation/models/base_automation.py @@ -164,7 +164,7 @@ class BaseAutomation(models.Model): if '__action_done' not in self._context: self = self.with_context(__action_done={}) domain = [('model_name', '=', records._name), ('trigger', 'in', triggers)] - actions = self.with_context(active_test=True).search(domain) + actions = self.with_context(active_test=True).sudo().search(domain) return actions.with_env(self.env) def _get_eval_context(self): @@ -258,7 +258,7 @@ class BaseAutomation(models.Model): 'domain_post': domain_post, } try: - self.action_server_id.with_context(**ctx).run() + self.action_server_id.sudo().with_context(**ctx).run() except Exception as e: self._add_postmortem_action(e) raise e |
