[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
This commit is contained in:
len-odoo
2018-10-08 15:59:30 +02:00
committed by len-odoo
parent 085d504561
commit e88c5c1ece
2 changed files with 3 additions and 3 deletions
+2 -2
View File
@@ -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
+1 -1
View File
@@ -39,7 +39,7 @@
</template>
<template id="message_user_assigned">
<p>Dear <t t-esc="object.user_id.name"/>,</p>
<p>Dear <t t-esc="object.user_id.sudo().name"/>,</p>
<p>You have been assigned to the <t t-esc="object._description.lower()"/> <t t-esc="object.name_get()[0][1]"/>.</p>
<p>
<a t-att-href="'/mail/view?model=%s&amp;res_id=%s' % (object._name, object.id)"