odoo/doc/howtos/backend/exercise-wizard-multi

39 lines
1.7 KiB
Plaintext

Index: addons/openacademy/views/openacademy.xml
===================================================================
--- addons.orig/openacademy/views/openacademy.xml 2014-08-28 14:34:28.583004473 +0200
+++ addons/openacademy/views/openacademy.xml 2014-08-28 14:34:28.579004473 +0200
@@ -244,7 +244,7 @@
<field name="arch" type="xml">
<form string="Add Attendees">
<group>
- <field name="session_id"/>
+ <field name="session_ids"/>
<field name="attendee_ids"/>
</group>
<footer>
Index: addons/openacademy/wizard.py
===================================================================
--- addons.orig/openacademy/wizard.py 2014-08-28 14:34:28.583004473 +0200
+++ addons/openacademy/wizard.py 2014-08-28 14:34:28.579004473 +0200
@@ -5,14 +5,15 @@
class Wizard(models.TransientModel):
_name = 'openacademy.wizard'
- def _default_session(self):
- return self.env['openacademy.session'].browse(self._context.get('active_id'))
+ def _default_sessions(self):
+ return self.env['openacademy.session'].browse(self._context.get('active_ids'))
- session_id = fields.Many2one('openacademy.session',
- string="Session", required=True, default=_default_session)
+ 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):
- self.session_id.attendee_ids |= self.attendee_ids
+ for session in self.session_ids:
+ session.attendee_ids |= self.attendee_ids
return {}