Saturday, 5 July 2014

Odoo/ OpenERP: Customize one2many relational field

I was working on one2many relational field to integration one functionality. Worked on python code and then wrote an xml file for the same. Restarted my server. It showed me the row with headers and 'Add an item' button. When clicked on that it opened a pop-up to provide inputs. It shows all the fields with in sequence of it's own.


Q1. I need input fields in other sequence or don't need all fields.

A.   In xml you would have wrote code like this :

<field name="dirtyhandsphp" widget="one2many_list" colspan="4" nolabel="1">
<tree string="Details">
             <field name="field1" />
             <field name="field2" />
                     ---------------------------------------------
             <field name="designation" />
        </tree>                                                    
</field>

Add form section inside and mention all the fields you needed, as follow :

<field name="dirtyhandsphp" widget="one2many_list" colspan="4" nolabel="1">
<tree string="Details">
             <field name="field1" />
             <field name="field2" />
                     ---------------------------------------------
             <field name="designation" />
        </tree>
        <form string="Details" editable="bottom">
             <field name="field1" />
             <field name="field2" />
                     ---------------------------------------------
             <field name="designation" />
        </form>                                            
</field>

Q2. Fields are few so want to edit at the same place. No separate pop-up.

A. Add editable attribute to tree tag as follow

<tree string="Details" editable="bottom">

or

<tree string="Details" editable="top">


Thanks!!!!!!!! Enjoy Programming:)


No comments:

Post a Comment

Thanks for your valuable comments.

Odoo 10: Close wizard and open standard form

Hi, Today we are going to learn how to open standard form after saving data in wizard. Let's say I have created an wizard to fill bas...