[IMP] event_track_calendar_event_event_speaker:

change position of event_speaker in data model
This commit is contained in:
clementthomas
2024-07-26 10:44:59 +02:00
parent a72126d0a8
commit bc014155fa
5 changed files with 46 additions and 3 deletions

View File

@@ -1 +1,2 @@
from . import event_track
from . import calendar_event

View File

@@ -0,0 +1,10 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo import fields, models, api, Command
class CalendarEvent(models.Model):
_inherit = 'calendar.event'
speaker_ids = fields.Many2many(
'res.partner', "calendar_event_speaker_rel", "calendar_event_id", "speaker_id", string="Speakers", domain="[('is_company','=',False)]"
)

View File

@@ -5,6 +5,19 @@ from odoo import fields, models, api, Command
class EventTrack(models.Model):
_inherit = "event.track"
speaker_ids = fields.Many2many(
'res.partner', string="Speakers", compute="compute_speaker_ids"
)
def compute_speaker_ids(self):
"""set speaker_ids as concat of all speakers of all events"""
for track in self:
speaker_ids = set()
for event in track.calendar_event_ids:
speaker_ids.update(event.speaker_ids.ids)
track.speaker_ids = list(speaker_ids)
def get_calendar_event_partner_value(self):
"""Add speaker ids to calendar event partners
"""