From d9f16de7bbacec9fabb45db84d6541a9e53c9fb2 Mon Sep 17 00:00:00 2001 From: Florian Damhaut Date: Mon, 28 Mar 2022 10:06:01 +0000 Subject: [PATCH] [FIX] microsoft_calendar: Send html description to outlook Step to reproduce: - Create a with a link in the decription - Edit + Save multiple times Current behaviour : - Since c2b545fd8d91b7d24380ada07adee02f24623ecf we fetch the full description with html tags which are rendered via the - When we resend this message to outlook, the description will be updated via html2plaintext. In the case of URL, they will be added as a footnote and thus duplicated if the url is it's own name Behaviour after thr PR: - We could then also send the description with the html tags to ensure full compatibility between the description - Using html2plaintext update the descrtiption to markdown, with some issues, since html is now supported in the odoo editor, using html on both end will remove the need to use html2plaintext and the descriptions changes stemming from it. opw-2746358 closes odoo/odoo#87411 X-original-commit: 4c3b69a30d5724dfef2b179ac8eaeecb8ff3da42 Signed-off-by: Arnaud Joset Signed-off-by: Damhaut Florian (flda) --- addons/microsoft_calendar/models/calendar.py | 6 +++--- addons/microsoft_calendar/tests/test_sync_odoo2microsoft.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/addons/microsoft_calendar/models/calendar.py b/addons/microsoft_calendar/models/calendar.py index 925eb23434a..60012a4b45b 100644 --- a/addons/microsoft_calendar/models/calendar.py +++ b/addons/microsoft_calendar/models/calendar.py @@ -7,7 +7,7 @@ from dateutil.relativedelta import relativedelta from odoo import api, fields, models, _ from odoo.exceptions import UserError, ValidationError -from odoo.tools import html2plaintext, is_html_empty, plaintext2html +from odoo.tools import is_html_empty ATTENDEE_CONVERTER_O2M = { 'needsAction': 'notresponded', @@ -274,8 +274,8 @@ class Meeting(models.Model): if 'description' in fields_to_sync: values['body'] = { - 'content': html2plaintext(self.description) if not is_html_empty(self.description) else '', - 'contentType': "text", + 'content': self.description if not is_html_empty(self.description) else '', + 'contentType': "html", } if any(x in fields_to_sync for x in ['allday', 'start', 'date_end', 'stop']): diff --git a/addons/microsoft_calendar/tests/test_sync_odoo2microsoft.py b/addons/microsoft_calendar/tests/test_sync_odoo2microsoft.py index 4f5a7b60115..cef20c0ec36 100644 --- a/addons/microsoft_calendar/tests/test_sync_odoo2microsoft.py +++ b/addons/microsoft_calendar/tests/test_sync_odoo2microsoft.py @@ -88,7 +88,7 @@ class TestSyncOdoo2Microsoft(TransactionCase): 'start': {'dateTime': '%s-01-15T08:00:00+00:00' % year, 'timeZone': 'Europe/London'}, 'end': {'dateTime': '%s-01-15T18:00:00+00:00' % year, 'timeZone': 'Europe/London'}, 'subject': 'Event', - 'body': {'content': '', 'contentType': 'text'}, + 'body': {'content': '', 'contentType': 'html'}, 'attendees': [], 'isAllDay': False, 'isOrganizer': True,