Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

launch wizard in python

By
voathnak lim
on 5/16/13, 6:21 AM 3,806 views

I have a requirement, to launch a wizard in my python. could anyone help me please!

here is my view:

        <record id="my_config_view_form" model="ir.ui.view">
            <field name="name">my.item.config.view</field>
            <field name="model">my.model.config</field>
            <field name="type">form</field>
            <field name="inherit_id" ref="base.res_config_view_base"/>
                <field name="arch" type="xml">

                    <group string="res_config_contents" position="replace">
                        <label colspan="4" align="0.0" string="
                            Configure this item by defining its field"/>
                        <field name="my_field"/>
                    </group>
                    <xpath expr="//button[@name='action_skip']"  position="attributes">
                        <attribute name="string">Proceed</attribute>
                        <attribute name="class">oe_highlight</attribute>
                    </xpath>
                    <xpath expr="//button[@name='action_next']" position="attributes">
                        <attribute name="string">Ok</attribute>
                        <attribute name="class">none</attribute>
                    </xpath>
                </field>
        </record>

        <record id="my_config_window" model="ir.actions.act_window">
            <field name="name">My config window</field>
            <field name="type">ir.actions.act_window</field>
            <field name="res_model">my.model.config</field>
            <field name="view_type">form</field>
            <field name="view_id" ref="my_config_view_form"/>
            <field name="view_mode">form</field>
            <field name="target">new</field>
        </record>

        <record id="my_config_step" model="ir.actions.todo">
            <field name="action_id" ref="my_config_window"/>
        </record>

I wrote this code but the wizard is not not showing:

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


        return {
            'name': 'test',
            'view_type': 'form',
            'view_mode': 'form',
            'view_id': 'my_config_view_form',
            'res_model': 'my.model.config',
            'domain': [],
            'context': context,
            'type': 'ir.actions.act_window',
            'target': 'new',
        }

could anyone write a python code to launch this wizard? Please!

voathnak lim
on 5/16/13, 8:00 AM

Hi, you cannot return an action or view or wizard in an onchange function. You can find example of return view in python in account/account.py with function "execute" or "fiedls_view_get", but are used to override an existant function. Bye

Cyril Gaspard (GEM)
on 5/19/13, 11:29 AM

Hello, thank you for your answer. but what if I really want to return in in onchange function. how can i do?

voathnak lim
on 5/23/13, 7:30 AM

Hi, I repeat a second time, it is not possible to return a view in an onchange. Bye

Cyril Gaspard (GEM)
on 5/23/13, 7:37 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

0 follower(s)

Stats

Asked: 5/16/13, 6:21 AM
Seen: 3806 times
Last updated: 3/16/15, 8:10 AM