Skip to main content

How to Create a Wizard in Odoo

Odoo is a powerful suite of business applications that can help businesses of all sizes manage and grow their operations. While it offers a wide range of features and functions, one of the things that makes Odoo so powerful is its ability to be customized to meet the specific needs of each business.

In this blog post, we will show you how to create a wizard in Odoo. Wizarding is a great way to streamline complex processes for your customers, and with Odoo, it is easy to create wizards that are both user-friendly and engaging. So, if you are looking for a way to make your business process more efficient, read on!

The snippet below add a new action called Download All to the Quotation list’s action menu.

class SaleOrderWizard(models.TransientModel):
    _name = 'wizard.sale.order.download'

    def _default_orders(self):
        return self.env['sale.order'].browse(self._context.get('active_ids'))

    sale_ids = fields.Many2many('sale.order', string='Sales', default=_default_orders,
                                 auto_join=True, required=True, readonly=True)

    @api.multi
    def download_all(self):
        if self.sale_ids:
        	for sale in self.sale_ids:
        		# Do something here
<odoo>
    <data>
        
        <act_window id="download_all"
                    name="Download All"
                    src_model="sale.order"
                    res_model="wizard.sale.order.download"
                    view_mode="form"
                    target="new"
                    multi="True"/>
        <record model="ir.ui.view" id="custom_form_view">
            <field name="name">wizard.sale.order.custom.form</field>
            <field name="model">wizard.sale.order.custom.cancel</field>
            <field name="arch" type="xml">
                <form string="Quotations">
                    <group>
                        <field name="order_ids"/>
                    </group>
                    <footer>
                        <button name="download_all" type="object" string="Download" class="oe_highlight"/>
                        or
                        <button special="cancel" string="Cancel"/>
                    </footer>
                </form>
            </field>
        </record>

    </data>
</odoo>

By continuing to use the site, you agree to the use of cookies.