[FIX] event: fix event description edition (leak from one to another)

When saving a description the one edited doesn't appear but the one edited
previously instead. This fixes this problem.

Technical note: the default description for a new event was the rendering of
a template. That template was shared between all the events and overridden each
time.
The solution was to strip the identity of the template while rendering it
making it a constant and preventing it from being shared between events.
This could be done by setting rendering_bundle to True in the rendering context
(unfortunately, t-ignore is not a legitimate attributes of template tag).

Note that the same fix [1] was done on `website_hr_recruitment`.

[1]: https://github.com/odoo/odoo/commit/f1ee633f26a78636fede3e2b600c801b5f474a50

Task-2781443

closes odoo/odoo#89520

X-original-commit: 5e8be9024b8fd1cdd7caf3cb711861a4a7bee2c8
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
This commit is contained in:
Pierre-Yves Dufays
2022-04-24 13:05:08 +02:00
committed by Romain Derie
parent 158b537c28
commit 5717543b04
+3 -1
View File
@@ -91,7 +91,9 @@ class EventEvent(models.Model):
return self.env['event.stage'].search([], limit=1)
def _default_description(self):
return self.env['ir.ui.view']._render_template('event.event_default_descripton')
# avoid template branding with rendering_bundle=True
return self.env['ir.ui.view'].with_context(rendering_bundle=True) \
._render_template('event.event_default_descripton')
def _default_event_mail_ids(self):
return self.env['event.type']._default_event_mail_type_ids()