[FIX] google_calendar: prevent google meet links when location is set

Issue
    When a location is set on an event, the google meet link is also
    generated, leading to confusion about the meeting format.

Steps to reproduce
    - Create an event with a location
    - Sync the Calendar with Google.
    - Observe that a Google Meet link is sent with the email.

Solution
    check if the loacation is set before generating a google meet link.

opw-3589379

closes odoo/odoo#149654

X-original-commit: 6aabe1b30598a8a616db01ae46dffece8f3f876c
Signed-off-by: Leonardo Pavan Rocha <lpr@odoo.com>
Signed-off-by: Kawtar Drissi El Bouzaidi (kdeb) <kdeb@odoo.com>
This commit is contained in:
kdeb@odoo.com
2024-01-17 07:54:45 +00:00
parent 72e123e8db
commit 5e9918f845
3 changed files with 20 additions and 1 deletions
+1 -1
View File
@@ -313,7 +313,7 @@ class Meeting(models.Model):
'useDefault': False,
}
}
if not self.google_id and not self.videocall_location:
if not self.google_id and not self.videocall_location and not self.location:
values['conferenceData'] = {'createRequest': {'requestId': uuid4().hex}}
if self.privacy:
values['visibility'] = self.privacy
@@ -76,3 +76,8 @@ class TestSyncGoogle(HttpCase):
while funcs:
func = funcs.popleft()
func()
def assertGoogleEventHasNoConferenceData(self):
GoogleSync._google_insert.assert_called_once()
args, _ = GoogleSync._google_insert.call_args
self.assertFalse(args[1].get('conferenceData', False))
@@ -764,3 +764,17 @@ class TestSyncOdoo2Google(TestSyncGoogle):
self.assertFalse(record.active, "Event must be archived in Odoo after unlinking it")
self.assertTrue(record.need_sync, "Sync variable must be true for updating event in Google when sync re-activates")
self.assertGoogleEventNotDeleted()
@patch_api
def test_videocall_location_on_location_set(self):
partner = self.env['res.partner'].create({'name': 'Jean-Luc', 'email': 'jean-luc@opoo.com'})
event = self.env['calendar.event'].create({
'name': "Event",
'start': datetime(2020, 1, 15, 8, 0),
'stop': datetime(2020, 1, 15, 18, 0),
'partner_ids': [(4, partner.id)],
'need_sync': False,
'location' : 'Event Location'
})
event._sync_odoo2google(self.google_service)
self.assertGoogleEventHasNoConferenceData()