Hi,
I have a model with a One2many field named product_ids among others and a form to create/edit records. On this form, product_ids are displayed as a tree in a page and I would like to have a drop-down list showing the names of all the existing records of the same model + a copy button to remove current products in the tree view and replace them with the ones from the selected record in the drop-down list.
I am able to display the list and the button but cannot figure how to make it work.
I tried several things. I'm able to have a method called on click on the button, but I cannot access the selected value in the drop-down list. I also added a onchange listener to the drop-down (in fact a Many2one field pointing to the same model) to save its value somewhere. It works but the RPC call takes a long time (more or less 2 seconds), enough for users to click on the "copy" button before data are updated server side.
Could you please tell me how could I send a value (current record selected in drop-down list) along with the RPC call when the button is clicked? Do you think I would have to write my own widget?
Thanks for your help.