Skip to Content
Menu
This question has been flagged
1 Reply
1451 Views
How can I fill a One2many of a model but calling an action from a button, and of course, always be updated with what I have added


Avatar
Discard
Author
What I want to do is that in the form of a model, when pressing a button, a window opens with a One2many of that model, having the possibility of adding new elements and showing me all the records that have been added.


Best Answer

Hello Pavel,

To Add records and update in one2many tree view below are ways you can use your python function of the button.

1. Create and write a record of one2many model with setting many2one relation field by calling create/write method from the function of the button.

2. Link record to model using write method. You can refer below link for that.

https://www.odoo.com/forum/help-1/how-to-insert-value-to-a-one2many-field-in-table-with-create-method-28714

Avatar
Discard