A wizard is a finite state machine.
There is also a more practical introduction into wizards.
This is the base for any wizard. It contains the engine for the finite state machine. A wizard must have some State instance attributes that the engine will use.
Class attributes are:
It contains the unique name to reference the wizard throughout the platform.
It contains the name of the starting state.
It contains the name of the ending state.
Same as trytond.model.Model.__rpc__.
Class methods are:
Setup the class before adding into the trytond.pool.Pool.
Setup the class after added into the trytond.pool.Pool.
Register the wizard.
Create a session for the wizard and returns a tuple containing the session id, the starting and ending state.
Delete the session.
Execute the wizard for the state. session_id is a session id. data is a dictionary with the session data to update. active_id, active_ids and active_model must be set in the context according to the records on which the wizard is run.
This is the base for any wizard state.
Instance attributes are:
The name of the state.
A StateView is a state that will display a form in the client. The form is defined by the ModelView with the name model_name, the XML id in view and the buttons.
Instance attributes are:
The XML id of the form view.
The list of Button instances to display on the form.
Instance methods are:
Returns the view definition like fields_view_get().
Return default values for the fields.
A StateTransition brings the wizard to the state returned by the method having the same name as the state but starting with transition_.
A StateAction is a StateTransition which let the client launch an ir.action. This action definition can be customized with a method on wizard having the same name as the state but starting with do_.
Instance attributes are:
The XML id of the ir.action.
Instance methods are:
Returns the ir.action definition.
A Button is a single object containing the definition of a wizard button.
Instance attributes are:
The label display on the button.
The next state to reach if button is clicked.
The name of the icon to display on the button.
A boolean to set it as default on the form.