This question has been flagged
5462 Views

Task

Provide a GUI so that partner (table res_partner) can be registered to events (table res_event) via the many2many join table registration (table event_registration).

  1. user selects a single event from a list of events
  2. user selects one or more partners from a list of partner
  3. confirmation of registration triggers inserts into join table

Proposed Solution

Multi step wizard wizard where the first wizard page/step handles step 1 from above (event selection) and the second page/step handles step 2 (partner(s) selection). The confirmation may be included in page 2 or as separate page 3 of the wizard.

Question

Is a wizard the right approach for this task?

How can I get the correct data on each page of the wizard. The partner list on the second page depends on the event selection of the first page as only partners that aren't already registered for this event should be displayed.

I was thinking about using a osv_memory wizard but find it difficult to imagine how and when to initialize the events and partners to be displayed for selection.

class wizard_with_step(osv.osv_memory):
    _name = 'wizard.with.step'
    _columns = { 
          'events_list': ???,
          'partners_list': ???,
          'event_selected': ???,
          'partners_selected': ???,
          'state': fields.selection([('step1', 'Event Selection'), ('step2', 'Parnter Selection'), ('step3', 'Confirmation')])  
          }
    _defaults = {
        'state': 'step1',
    }

    def action_next(self, cr, uid, ids, context=None):
        ???

    def action_previous(self, cr, uid, ids, context=None):
        ???

Would this be a reasonable approach for the task described? If so how should the event and partner data be initialized and where should the intermediate results (the selected event and partners) be stored?

Avatar
Discard

Did you have a look there : https://www.odoo.com/forum/Help-1/question/How-to-create-a-wizard-with-steps--19828 ?