I'm aiming to relate meetings to tasks in a m2o relationship.
I created event_ids o2m field in project.tasks, and corresponding task_id m2o in calendar.events. I added a project_id (m2o to account.analytic.account) to the calendar event: I didn't use a related field (task_id.project_id) since I would let the user to choose an analytic account even for Meetings created outside the task.
I added a m2o tree to task form view.
Now, in the Create task form, when I add a new event from the task form I'd like to have the event form pre-populated with data taken from the task, eg.: name, project_id, date_start, date_end, followers_ids.
I added a context to the event_ids, like this example:
<field name="event_ids" context="{'default_name': name, 'default_project_id': project_id, 'default_start_datetime': date_start, 'default_stop_datetime': date_end}" />
When the Meeting creation form opens, all fields get populated but project_id.
How should I proceed? Is there any module I can get inspiration from?
Should I use a button action to create a calendar.event instead of the "add new item" event of treeview?