odoo/odoo#200485

Created by fw-bot
Merged at fdae546f2d428f5f4ddfcd985d30364b85db597d

Statuses:

label
odoo-dev:master-16.0-opw-4500292-calendar_activities_events-sast-420769-fw
head
75320fbe8d1cb2bb6865b15a9fe0ddb8a9563ac4
merged
8 months ago by Samuel Struble (sast)
odoo/odoo
16.0 #196719
17.0 #197761
saas-17.4 #199053
18.0 #199086
saas-18.1 #200466
saas-18.2 #200478
saas-18.3
saas-18.4
19.0
master #200485

[FW][FIX] calendar: correctly create new activities when creating multiple new calendar events from chatter

To reproduce:
- on a record of a model that inherits mail.activity.mixin, create a new Activity of a 'meeting' type
- open calendar
- create 2 meetings on the calendar
- only the second one is attached to the resource record's chatter

Problem:
When the calendar view is opened, the mail.activity record has already been created, and creating the calendar.event record writes to its calendar_event_id field with the id of the newly created calendar.event. Creating a second calendar.event record in the same view does not create a second mail.activity record, instead it overwrites the calendar_event_id field of the original mail.activity record, overwriting the original calendar.event. This also causes the first calendar.event record to no longer have any associated mail.activity record in its activity_ids field.

Solution:
In the calender.event create() method, modify the condition of whether a new mail.activity record should get created so that it makes a new mail.activity record if the linked mail.activity record already has a calender_event_id

opw-4500292

I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr

Forward-Port-Of: #199086
Forward-Port-Of: #196719