1
votes

My question would be can I call Add an item button which appears bellow many2many field and give that functionality to my custom button. The result would be something like this: I have a simple primary button and invisible many2many field. When i click my primary button i get to fill my many2many field which still has to stay invisible. Basically primary button has to open form that would be opened by add an items button.

Thank you for considering my question I hope it was clear :) !

1
If you are experienced odoo developer and you read this question thinking -Nop, not gonna happen, be honest and say that it is hardly possible and I shouldn't waste my timeenigmq
Or maybe there is an alternative way to fill invisible many2many field?enigmq

1 Answers

1
votes

You can always try it with a "wizard" resp. transient model as intermediate to fill the many2many field.

So you will have to call the form of that wizard, which should hold your records ID either in context or as field, because you will later write on it to fill the many2many. And ofcourse you need a many2many on this wizard, which will be filled by the user and which content will be written to the record you called the wizard from.


Another alternative is to look into the js code of odoo and to find the functionality of the select and add buttons. You can then try to define another type of button or just try to get the functionality out of js to python (your button method).