Skip to Content
Menu
This question has been flagged
1 Reply
10110 Views

I am trying to add a field (only a checkbox) to a wizard. I managed to do exactly this with other form, but it was not a wizard. But I repeated the same steps (obviously changing the respective names and variables) and I cannot see my field in the wizard. I inherited the original wizard as I did with the form which worked, but I do not know if I am doing something stupid, because I have just arrived to OpenERP a few time ago.

The structure of my module is:

my_module
|__ wizard
|   |__ __init__.py
|   |__ wizard_print.py
|
|__ __init__.py
|__ __openerp__.py
|__ my_module_wizard.xml

And my two important files are:

wizard_print.py (in a folder called wizard which has its respective __init__.py too)

from osv import fields, osv

class print_wizard(osv.osv_memory):

    _name = 'my.module.print.wizard'
    _inherit = 'original.module.print.wizard'
    
    _columns = {
        'dummy': fields.boolean('My dummy'),
    }
    _defaults = {
         'dummy': True,
     }

print_wizard()

my_module_wizard.xml (in the main folder with the __openerp__.py and __init__.py)

<?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data>
        <record model="ir.ui.view" id="wizard_my_module_print">
            <field name="name">my.module.print.wizard.form</field>
            <field name="model">my.module.print.wizard</field>
            <field name="inherit_id" ref="original_module.wizard_original_module_print"/>
            <field name="type">form</field>
            <field name="arch" type="xml">
                <xpath expr="/form/field[@name='original_variable']" position="after">
                    <newline/>
                    <field name="dummy"/>
                    <newline/>
                </xpath>
            </field>
         </record>
    </data>
</openerp>

Is this structure right? Should it work or is there any mistake I do not know?

Avatar
Discard
Author

Thank you @René Schuster! I removed both: _name from the python declaration and from the XML view. But it does not work yet.

Author

Ok I did not have to delete the field in the XML view! In the XML view I had to change the content of the tag : replace my.module.print.wizard by original.module.print.wizard. I had understood you wrong!

Best Answer

If you inherit from an existing model and set a different _name value, an new model will be created.

I think that is not quite what you want.

Change the _name value to "original.module.print.wizard" (in the python declaration and the xml view).

For more information see the Technical Mementos section on different inheritance mechanisms: https://www.odoo.com/files/memento/OpenERP_Technical_Memento_latest.pdf

Or this: http://stackoverflow.com/questions/21111627/inheritance-of-customized-module-in-openerp

 

Regards.

Avatar
Discard
Related Posts Replies Views Activity
0
Nov 15
4783
1
Mar 15
4780
4
Mar 24
2528
1
Oct 23
4504
3
Sep 23
2596