Odoo Help


error in open a wizard from python code?

on 6/21/13, 1:41 PM 2,280 views


in a custom module, I have inherit account.invoice and create a new method which is executed after invoice validation for opening a wizard defined in the custom module.

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

    action = {
        'type': 'ir.actions.act_window',
        'view_type': 'form',
        'view_mode': 'form',
        'res_model': 'iota.task.picking',
        'target': 'new',
        'view_id': False,
    return action

The XML view for the wizard :

        <record model="ir.ui.view" id="view_iota_task_picking">
        <field name="name">Invoice validation</field>
        <field name="model">iota.task.picking</field>
        <field name="type">form</field>
        <field name="arch" type="xml">
            <form string="Invoice validation" >
                <field name="partner_id" />
                <separator string="Tasks" colspan="4"/>
                    <field name="task_ids" />
                <separator string="Picking" colspan="4"/>
                <group colspan="2" col="6" >
                    <field name="date_receipt" />
                    <field name="pick_ids" /> 
                <separator string="" colspan="4"/>
                <button special="cancel" string="Cancel" icon="gtk-cancel"/>
                <button name="action_confirm" string="Validate" type="object" icon="gtk-apply"/>  

When running action_task_picking, I obtain message (in french)

Impossible d’obtenir la propriété  « view_type » d’une référence null ou non définie

I translate by

Unable to get property view_type for null or undefined reference

What is wrong in pyton code ?

Dharmesh Rathod
On 6/22/13, 2:57 PM


You have to provide ID value for FORM view.

Acespritech Solutions Pvt Ltd

Hi, i've tried to add : 'view_id': 1198, (the id of the view in ir_ui_view) in the dictionnary but always the same error message

on 6/24/13, 11:06 AM
On 6/28/13, 5:25 AM


it works by calling wizard like that :

    modl_obj = self.pool.get('ir.model.data')
view_id_res=modl_obj.get_object_reference(cr, uid, 'my_custom_module', 'view_iota_task_picking')[1]
return {
    'type': 'ir.actions.act_window',
    'view_id': False,
    'view_type': 'form',
    'view_mode': 'form',
    'views': [(view_id_res, 'form')],
    'res_model': 'iota.task.picking',
    'nodestroy': True,
    'target': 'new',
    'context': context,

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 platform 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.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

0 follower(s)


Asked: 6/21/13, 1:41 PM
Seen: 2280 times
Last updated: 3/16/15, 8:10 AM