Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
1360 Переглядів

Hello folks,

We've written a custom module to extend the Appointments app to allow scheduling to occur with Zoom links instead of using the built in WebRTC Discuss or Google Meet options, however when the invite emails go out, we are seeing that the description field is being rendered as escaped text instead of embedded html.

After reviewing the documentation for the changed introduced in v16 ( we are running v17), we noted that the default behavior is to escape anything deemed unsafe, however as the description field on the calendar is set to an html field type, we'd expect this not to be escaped per the documentation.

It's worth noting that if we don't append anything to the field, it renders as expected per the default behavior and it appears to render as html, however when we try to append to it (we have validated our updates are still consistent with valid html) it is being escaped.

Looking for any ideas as to what we might be missing here!

Custom function in the CalendarEvent extension module shown here to show how we are modifying that field:

    @api.depends('zoom_meet_code', 'zoom_meet_url')
    def _compute_description(self):
        events_w_zoom = self.filtered(lambda event: event.videocall_source == 'zoom_call')
        for event in events_w_zoom:
            event.location = self.zoom_meet_url
            event.videocall_location = self.zoom_meet_url
            event.description += "
Join the Zoom Meeting at " + str(self.videocall_redirection)

We have also confirmed via some debug printing statements the contents of event.description is consistently the correct html code

Аватар
Відмінити
Автор

Also for reference, we did try wrapping the urls in href/a tags as well but had to cut that from here in order to post

Автор

Adding some additional info in the event it is of use around the inherited class
class CalendarEvent(models.Model):
"""Inheriting Calendar events to create zoom meetings"""
_inherit = 'calendar.event'

is_zoom_meet = fields.Boolean(string='Zoom Meet',
help='Enable, if zoom meeting.')
zoom_meet_url = fields.Char(string='Zoom Meet URL',
help='To joining Meeting URL')
zoom_meet_code = fields.Char(string='Zoom Meet Code',
help='Joining Meeting Code')
zoom_event = fields.Char(string='Zoom Event ID',
help='Event ID of the zoom meet')
videocall_location = fields.Char('Meeting URL', related='zoom_meet_url')
description = fields.Text('Description',
compute="_compute_description", store=True)
company_id = fields.Many2one('res.company', string='Company')
zoom_users_list = fields.Selection(related='company_id.zoom_users_list',
string='Zoom User',
help='Select the Zoom account to use when scheduling this meeting',
readonly=False
)
videocall_source = fields.Selection(selection_add=[('zoom_call', 'Zoom')])

And the following in the section in question from the email template:

_____
<li t-if="object.videocall_redirection">
How to Join:
<t t-if="object.videocall_source == 'discuss'"> Join with Odoo Discuss</t>
<t t-else=""> Join at</t><br/>
<a t-attf-href="{{ object.videocall_redirection }}" target="_blank" t-out="object.videocall_redirection or ''">www.mycompany.com/calendar/join_videocall/xyz</a>
</li>
</ul>
<t t-if="not is_html_empty(object.description)">
<li>Description of the event:
<t t-out="object.description"/>
</li>
_____

Related Posts Відповіді Переглядів Дія
0
вер. 24
850
0
серп. 25
419
2
трав. 25
1074
4
трав. 25
2872
2
трав. 25
6304