summaryrefslogtreecommitdiff
path: root/addons/mail/models/mail_thread.py
diff options
context:
space:
mode:
authorMartin Trigaux <mat@odoo.com>2020-01-22 15:16:22 +0000
committerMartin Trigaux <mat@odoo.com>2020-01-28 13:58:05 +0000
commita74a6480302620be364d2d15717fce59db3ddf4e (patch)
treeea350f32d91ceb078c4de5efd754bc15c08b450b /addons/mail/models/mail_thread.py
parent41a465bc869a96b7a4e2b49a691360827019b0ea (diff)
[IMP] *: use ast.literal_eval
When simply need to parse a domain, it is easier Add .strip() on ir.ui.view as ast.literal_eval produces an syntax error if the node starts with spaces (as done in the xpath of hr_attendance.view_employee_form_inherit_hr_attendance) closes odoo/odoo#43831 Related: odoo/enterprise#7894 Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
Diffstat (limited to 'addons/mail/models/mail_thread.py')
-rw-r--r--addons/mail/models/mail_thread.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/addons/mail/models/mail_thread.py b/addons/mail/models/mail_thread.py
index ed0e9145344..2e94ea0cf44 100644
--- a/addons/mail/models/mail_thread.py
+++ b/addons/mail/models/mail_thread.py
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
+import ast
import base64
import datetime
import dateutil
@@ -31,7 +32,6 @@ from odoo.osv import expression
from odoo.tools import pycompat, ustr
from odoo.tools.misc import clean_context, split_every
-from odoo.tools.safe_eval import safe_eval
_logger = logging.getLogger(__name__)
@@ -416,7 +416,7 @@ class MailThread(models.AbstractModel):
doc = etree.XML(res['arch'])
for node in doc.xpath("//field[@name='message_ids']"):
# the 'Log a note' button is employee only
- options = safe_eval(node.get('options', '{}'))
+ options = ast.literal_eval(node.get('options', '{}'))
is_employee = self.env.user.has_group('base.group_user')
options['display_log_button'] = is_employee
# save options on the node
@@ -1001,7 +1001,7 @@ class MailThread(models.AbstractModel):
routes = []
for alias in dest_aliases:
user_id = self._mail_find_user_for_gateway(email_from, alias=alias).id or self._uid
- route = (alias.alias_model_id.model, alias.alias_force_thread_id, safe_eval(alias.alias_defaults), user_id, alias)
+ route = (alias.alias_model_id.model, alias.alias_force_thread_id, ast.literal_eval(alias.alias_defaults), user_id, alias)
route = self._routing_check_route(message, message_dict, route, raise_exception=True)
if route:
_logger.info(