Wizards is used to show the view of any project in Odoo and the interactive sessions with user (or dialog boxes) through dynamic forms is also described by Wizards. A wizard is simply a model that extends the class TransientModel instead of Model. The class TransientModel extends Model and reuse all its existing mechanisms. for example you can see below code.
from . import controllers
from . import models
from . import partner
from . import wizard
openacademy/wizard.py
# -*- coding: utf-8 -*-
from openerp import models, fields, api
class Wizard(models.TransientModel):
_name = 'openacademy.wizard'
session_id = fields.Many2one('openacademy.session',
string="Session", required=True)
attendee_ids = fields.Many2many('res.partner', string="Attendees")
Note- the above example ststes a wizard model with a many2one relationship with the Session model and a many2many relationship with the Partner model.
0 Comment(s)