Am working with Odoo 10 and I want two things:
Then the button,
- Will execute some code that operates with the selected objects.
I would like to know how to insert the button and the best approach for point number 2.
Following is the way to create a new menu in More menu.
1. Need to create new action for that menu.
<record model="ir.actions.act_window" id="action_id_1">
<field name="name">action.name</field>
<field name="view_id" ref="view_id_1"/>
<field name="domain">[]</field>
<field name="context">{}</field>
<field name="res_model">Current Model</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
2. Binding events to action
The available type of events are following
You have to use the client_action_multi and define the action_id in value. See below example.
<record model="ir.values" id="ir_value_id">
<field name="model_id" ref="module_name.model_<model_name>" />
<field name="name">Create Delivery</field>
<field name="key2">client_action_multi</field>
<field name="value" eval="'ir.actions.act_window,' + str(ref('action_id_1'))" />
<field name="key">action</field>
<field name="model">model.name</field>
</record>
So, At the end you have new option under the more menu.