Help

0

How to open a tree/list view after click on "add a line" in one2many tree view? (Odoo 13)

Avatar
khanhqn

Hello,

I created a one2many tree view in the form view. After click on "add a line" in one2many tree view. It will open a form view of a model connected by many2one.

Cause I want to select directly the value from the tree/list view which has already the values.

So how to open the tree/list view of the model connected by many2one via "add a line" in one2many tree view?

Please help!

Thank you!


Avatar
Discard
2 Answers
0
Avatar
Niyas Raphy
Best Answer

Hi,

Seems you need to enter the values directly in the one2many tree view, rather than entering in the one2many form. For this what you have to do is that, set editable="bottom" along with the one2many tree definition.

Sample:

<field name="state_ids">
<tree editable="bottom">
<field name="name"/>
<field name="code"/>
</tree>
</field>

Reference: One2many Field - Editable Bottom and Top


Thanks

1 Comment
Avatar
Discard
Avatar
khanhqn
-

Hi Niyas, thank you for your support. That's useful information.

But not in my wish. I mean I have a list view that already has a value. Now I want to load that list view for selecting directly the value via button: 'add a line', not enter directly the value into the one2many field.

0
Avatar
khanhqn
Best Answer

I'd solved my wish.

Just add the widget='many2many' after one2many field.

And it will load the list view for selecting the value.

Thank you!

Avatar
Discard