I was searching the web for quite a while and could not find the proper code syntax to solve the problem. Here is the business case and solution:
Business Case:
A company is organizing Dance Events (makes contracts with dance groups and festival locations). The festival visitors and selling tickets for the festivals are not relevant! This is done by someone else.
They want to keep track in the contacts (res.partner) who participated in the past in what dance festival to make use of that for future events. For this a new many2many field has been created "x_studio_festival_ids"
Relationship / Structure in contacts (res.partner) is the following:
- one contact for the COMPANY participating in festivals (this is the related company, which has child_ids, see below)
- child_ids: multiple other contacts (individuals), which are related to the contact above
Requirements:
As responsible event manager I want to
- get a list of all contacts (company & individuals) with participation in the actual festival to see company name and the related individuals with their roles (Job Title) and contact details to have a full list of all relevant persons of the current festival.
- be able, when I prepare a future festival to filter for companies, who participated in the past in festivals and to see the relevant individuals working in those companies with their contact details.
- the solution must be an automated action
- the contact can have multiple participations in the past and it should work in the same way as the contacts tags provided in odoo standard but in a separate field (--> new many2many field)