[FW][FIX] calendar: use the event_tz in mail templates

Try to use the event_tz before falling back on the mail_tz (user tz) in the
context. Add a tool method allowing to override this behavior easily instead
of concatenating "or". As template is modified anyway translations are already
broken.

Task-2699765

closes odoo/odoo#86513

X-original-commit: odoo/odoo@6ef642ccdc
Part-of: odoo/odoo#86070
Related: odoo/enterprise#25322
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
This commit is contained in:
Jérémy Hennecart (jeh)
2022-03-16 16:07:27 +01:00
committed by Thibault Delavallée
parent f50eaa4412
commit d248f5afce
3 changed files with 11 additions and 7 deletions
+1 -1
View File
@@ -369,7 +369,7 @@
<t t-set="target_responsible" t-value="object.partner_id == object.partner_id" />
<t t-set="target_customer" t-value="object.partner_id == customer" />
<t t-set="recurrent" t-value="object.recurrence_id and not ctx.get('calendar_template_ignore_recurrence')" />
<t t-set="mail_tz" t-value="ctx.get('mail_tz')" />
<t t-set="mail_tz" t-value="object._get_mail_tz() or ctx.get('mail_tz')" />
<div>
<table border="0" cellpadding="0" cellspacing="0">
<tr>
+6 -6
View File
@@ -173,11 +173,11 @@ msgstr ""
msgid ""
"<div>\n"
" <t t-set=\"colors\" t-value=\"{'needsAction': 'grey', 'accepted': 'green', 'tentative': '#FFFF00', 'declined': 'red'}\"/>\n"
" <t t-set=\"is_online = 'appointment_type_id' in object and object.appointment_type_id\"/>\n"
" <t t-set=\"target_responsible = object.partner_id == object.partner_id\"/>\n"
" <t t-set=\"target_customer = object.partner_id == customer\"/>\n"
" <t t-set=\"recurrent = object.recurrence_id and not ctx.get('calendar_template_ignore_recurrence'\"/>\n"
" <t t-set=\"mail_tz = ctx.get('mail_tz')\"/>\n"
" <t t-set=\"is_online\" t-value=\"'appointment_type_id' in object and object.appointment_type_id\"/>\n"
" <t t-set=\"target_responsible\" t-value=\"object.partner_id == object.partner_id\"/>\n"
" <t t-set=\"target_customer\" t-value=\"object.partner_id == customer\"/>\n"
" <t t-set=\"recurrent\" t-value=\"object.recurrence_id and not ctx.get('calendar_template_ignore_recurrence')\"/>\n"
" <t t-set=\"mail_tz\" t-value=\"object._get_mail_tz() or ctx.get('mail_tz')\"/>\n"
" <div>\n"
" <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n"
" <tr>\n"
@@ -272,7 +272,7 @@ msgid ""
" Hello <t t-out=\"object.common_name or ''\">Wood Corner</t>,<br/><br/>\n"
"\n"
" <t t-if=\"is_online and target_customer\">\n"
" Your appointment <strong t-out=\"object.event_id.appointment_type_id.name or ''\">Schedule a Demo</strong> with <t t-out=\"object.event_id.user_id.name or ''\">Ready Mat</t> has been booked.\n"
" Your appointment <strong t-out=\"object.event_id.appointment_type_id.name or ''\">Schedule a Demo</strong> <t t-if=\"object.event_id.appointment_type_id.category != 'custom'\"> with <t t-out=\"object.event_id.user_id.name or ''\">Ready Mat</t></t> has been booked.\n"
" </t>\n"
" <t t-elif=\"is_online and target_responsible\">\n"
" <t t-if=\"customer\">\n"
+4
View File
@@ -722,6 +722,10 @@ class Meeting(models.Model):
self.ensure_one()
return ",".join([e for e in self.attendee_ids.mapped("email") if e])
def _get_mail_tz(self):
self.ensure_one()
return self.event_tz or self.env.user.tz
def _sync_activities(self, fields):
# update activities
for event in self: