2
votes

I'd like to display some of the fields of a one2many field in the notebook of a form, so the user won't have to use the regular popup window you get when you simply put in the one2many field but can put the information straight into the individual fields on the page.

My view currently looks like this:

<field name="one2many">
    <form string="example">
        <field name="columnOfTheOne2Many"/>
    </form>
</field>

The fields are not displayed as they should be, I simply get the standard list as if I had simply put

<field name="one2many"/>

However, if I use tree instead of form, it works perfectly:

<field name="one2many">
       <tree string="Auftraggeber">
           <field name="columnOfOne2Many"/>
       </tree>
</field>

What am I missing with the form? Many thanks

3

3 Answers

2
votes

In the end, I managed to get what I wanted through delegation:

In my class.py:

class sample (osv.osv):
    _inherits = { 'res.partner' : 'partner_id'}

...which makes it possible to use all fields of res.partner my sample_view.xml. Whenever I create an instance of 'sample' and fill out any inherited fields of res.partner, a new instance of res.partner is also created.

Hope this will help somebody with similar problems

1
votes

Try with this (be careful of the 'mode' attribute) :

<field name="one2many" mode="form">
    <form string="example">
        <field name="columnOfTheOne2Many" />
    </form>
</field>
1
votes

@S.G.

You can also use the attribute

editable='top' or editable='bottom' in the tree view of one2many field.