From e88c5c1ece1e1e9474ee39a0a7a1e4acfea63916 Mon Sep 17 00:00:00 2001 From: len-odoo Date: Thu, 4 Oct 2018 13:19:14 +0200 Subject: [PATCH] [FIX] mail: sudo on user name Suppose user A creates a sale order S in company X. He then changes to company Y Sales manager B, in company X, creates the invoice for sale order S. Bug: the compilation of the report fails because of the user.name in the template. Then the tracking update fails, making it impossible to validate the invoice. opw 1884915 --- addons/mail/models/mail_tracking_value.py | 4 ++-- addons/mail/views/mail_templates.xml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/mail/models/mail_tracking_value.py b/addons/mail/models/mail_tracking_value.py index da38a678d06..5c3dc3d1f8e 100644 --- a/addons/mail/models/mail_tracking_value.py +++ b/addons/mail/models/mail_tracking_value.py @@ -60,8 +60,8 @@ class MailTracking(models.Model): values.update({ 'old_value_integer': initial_value and initial_value.id or 0, 'new_value_integer': new_value and new_value.id or 0, - 'old_value_char': initial_value and initial_value.name_get()[0][1] or '', - 'new_value_char': new_value and new_value.name_get()[0][1] or '' + 'old_value_char': initial_value and initial_value.sudo().name_get()[0][1] or '', + 'new_value_char': new_value and new_value.sudo().name_get()[0][1] or '' }) else: tracked = False diff --git a/addons/mail/views/mail_templates.xml b/addons/mail/views/mail_templates.xml index 97d9c834821..f3de6d2a405 100644 --- a/addons/mail/views/mail_templates.xml +++ b/addons/mail/views/mail_templates.xml @@ -39,7 +39,7 @@