I am using Odoo v.11 EE.
I'm following the "create a module" tutorial on the official docs (https://www.odoo.com/documentation/11.0/howtos/backend.html), so I made a 'course' module and a 'session' module etc, with no great issues.
If i go to the tree view for courses, and check some entries, an "Action" menu appears with a number of options (in this case, "Export" and "Delete"). I'd like to add a new option and bind it to some backend logic to be executed on the selected elements.
I found some hints online (e.g: https://stackoverflow.com/questions/36285497/how-to-add-entry-to-more-menu-or-top-menu-to-add-action-on-multiple-selections), but it doesn't seem to be working on odoo11.
Is there a standard way to accomplish that?
EDIT:
For now I managed to insert a button like the following
<button name="mymethod" string="My Method" type="object" class="oe_highlight"/>
and I binded it to a simple @api.multi method in the model:
@api.multi
def mymethod(self):
print("TEST")
return True
This works (i.e. when the button is clicked i see the "TEST" string in the console), but still I need to understand how to bind the method to an option in the "Action" drop-down (not to a button).
I managed to do a window action linked to an option in the "Action" drop-down (If i'm not wrong this is accomplished by setting the key2 field as "client_action_multi"), but what I need is a server action, so, by analogy, I tried to define it as follows:
<record model="ir.actions.server" id="act_new_sub_menu_lol">
<field name="name">CANT MAKE THIS WORK</field>
<field name="model_id" ref="model_openacademy_course"></field>
<field name="src_model">openacademy.course</field>
<field name="key2">client_action_multi</field>
<field name="view_mode">tree</field>
<field name="target">new</field>
<field name="view_type">tree</field>
</record>
But no option appears in the drop-down.
Thank you in advance for any help.
See this: https://www.youtube.com/watch?v=yGKYPtAeP7k