i am searchin to add a new button that displays my wizard to the action button display in the tree view
My wizard works because i tested it individually, but i need to add it to the action button on the top and i do not know how
I tried to use the action.server but did not find any example that helped me
Thanks
Also i know that from Odoo 10 to Odoo 12 changed, thats why i have not found any clue.
Next are the examples i tried but not succed
<record model="ir.actions.act_window" id="enviar_evaluacion">
<field name="name">enviar_evaluacion</field>
<field name="view_id" ref="vista_formulario_riesgo_para_evaluacion"/>
<field name="domain">[]</field>
<field name="context">{}</field>
<field name="res_model">pdi.riesgo</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
<record model="ir.actions.server" id="accion_servidor_evaluacion">
<field name="name">Enviar a evaluacion</field>
<field name="model_id" ref="model_pdi_riesgo_wizard_evaluacion"/>
<field name="state">code</field>
<field name="code">
object.enviar_a_evaluar(context.get('active_ids'))
</field>
</record>
next try
<record model="ir.actions.server" id="menu_action_evaluacion">
<field name="name">Enviar a evaluacion</field>
<field name="model_id" ref="model_pdi_riesgo"/>
<field name="state">code</field>
<field name="code">
action=pdi.riesgo.wizard.evaluacion.enviar_a_evaluar()
</field>
</record>
<menuitem id="menu_enviar_a_evaluacion"
name="Enviar a evaluacion"
parent="pdi_Riesgo.menu_riesgo_evaluaciones"
action="menu_action_evaluacion"/>
The "new" way is to set some new fields on actions. Following is an example from Odoo's app crm:
<!--
'Mark as Lost' in action dropdown
-->
<record id="action_mark_as_lost" model="ir.actions.server">
<field name="name">Mark as lost</field>
<field name="model_id" ref="model_crm_lead"/>
<field name="binding_model_id" ref="crm.model_crm_lead"/>
<field name="binding_view_types">list</field>
<field name="state">code</field>
<field name="code">
if record:
action_values = env.ref('crm.crm_lead_lost_action').read()[0]
action_values.update({'context': env.context})
action = action_values
</field>
</record>
So there are three fields on model ir.actions
(which is inherited by ir.actions.server
) all beginning with binding_
report
for the report menu and action
for the action menu (default)list,form
is default, list
and form
should also work, i didn't look into that field, so maybe there are way more combinations/values