A wizard describes a series of steps defined as State. The wizard stores data in ir.session.wizard between states.

The basics:

  • Each wizard is a Python class that subclasses Wizard.

  • The states of the wizard are attributes that are instances of State.

This example defines a wizard which export translations:

from trytond.wizard import Wizard, StateView, StateTransition, Button
from trytond.pool import Pool

class TranslationExport(Wizard):
    "Export translation"
    __name__ = 'ir.translation.export'

    start = StateView(
        'ir.translation_export_start_view_form', [
            Button("Cancel", 'end', 'tryton-cancel'),
            Button("Export", 'export', 'tryton-ok', default=True),
    export = StateTransition()
    result = StateView(
        'ir.translation_export_result_view_form', [
            Button("Close", 'end', 'tryton-close'),

    def transition_export(self):
        pool = Pool()
        Translation = pool.get('ir.translation')
        self.result.file = Translation.translation_export(
            self.start.language.code, self.start.module.name)
        return 'result'

    def default_result(self, fields):
        return {
            'file': self.result.file,

The class must be registered in the Pool.