If you want to register attendees to multiple sessions follow the below code in your Odoo module.
<group>
<field name="session_ids">
<field name="attendee_ids">
</field></field></group>
<footer>
<button name="subscribe" type="object"
openacademy/wizard.py
class Wizard(models.TransientModel):
_name = 'openacademy.wizard'
def _default_sessions(self):
return self.env['openacademy.session'].browse(self._context.get('active_ids'))
session_ids = fields.Many2many('openacademy.session',
string="Sessions", required=True, default=_default_sessions)
attendee_ids = fields.Many2many('res.partner', string="Attendees")
@api.multi
def subscribe(self):
for session in self.session_ids:
session.attendee_ids |= self.attendee_ids
return {}
Note-Modify the wizard model so that attendees can be registered to multiple sessions.
0 Comment(s)