summaryrefslogtreecommitdiff
path: root/addons/calendar/models
diff options
context:
space:
mode:
authorDjamel (otd) <otd@odoo.com>2021-04-27 09:06:40 +0000
committerDjamel (otd) <otd@odoo.com>2021-04-28 07:32:17 +0000
commitc9247bab92d022b9712b39d275f4b1ce1bfbcff5 (patch)
tree70f0a1751d154ba7221f070a267a5d1e623d0fa2 /addons/calendar/models
parent4f8b2da26c8e1318a977a1f330dc52256fcd48cf (diff)
[FIX] calendar: remove the company name from the email template
Steps to follow to reproduce the bug: - Create a new “Internal User” - Add him a “default company” - Add in the “allowed companies” a different company than his default company - In the “Technical” section, check that the “multi companies” box is checked - Log in with the new user - At the top right select a company other than his “default company” - In the “Calendar” app/ create a new meeting with a future date - Add another user as a participant - Confirm the meeting - Access rights error is triggered Problem: When participant are added, an invitation by email must be sent to all participants. The problem is in the template of the email that is sent, precisely in the "body", we add the name of the user's default company which we do not have access. Opw-2494399 closes odoo/odoo#69935 Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Diffstat (limited to 'addons/calendar/models')
-rw-r--r--addons/calendar/models/calendar_attendee.py17
1 files changed, 12 insertions, 5 deletions
diff --git a/addons/calendar/models/calendar_attendee.py b/addons/calendar/models/calendar_attendee.py
index 24db4c7ec41..105ff5b46fc 100644
--- a/addons/calendar/models/calendar_attendee.py
+++ b/addons/calendar/models/calendar_attendee.py
@@ -125,11 +125,18 @@ class Attendee(models.Model):
'mimetype': 'text/calendar',
'datas': base64.b64encode(ics_file)})
]
- body = invitation_template.with_context(rendering_context)._render_field(
- 'body_html',
- attendee.ids,
- compute_lang=True,
- post_process=True)[attendee.id]
+ try:
+ body = invitation_template.with_context(rendering_context)._render_field(
+ 'body_html',
+ attendee.ids,
+ compute_lang=True,
+ post_process=True)[attendee.id]
+ except UserError: #TO BE REMOVED IN MASTER
+ body = invitation_template.sudo().with_context(rendering_context)._render_field(
+ 'body_html',
+ attendee.ids,
+ compute_lang=True,
+ post_process=True)[attendee.id]
subject = invitation_template._render_field(
'subject',
attendee.ids,