Odoo Help


[V8][SOLVED]Call server actions with button using name and not ID?

on 7/3/15, 6:10 PM 1,398 views

I would like to call my server actions by name and not by id. 

Rest_av, id 640, for example:

 <button name="640" string="Avançar" type="action"/>

Id obviously works fine, I've tried with 

<button name="%(Rest_av)d" string="Avançar" type="action"/>
<button name="Rest_av" string="Avançar" type="action"/>

But is not working. What is the correct syntax? 

If is not possible (but it should be) I would like to create my server actions with predetermined id numbers. 

On 7/3/15, 6:29 PM

Ok. Looking more deeply on the documentation I found the solution. Is not possible since my server actions are obviously type action.

For the sake of knowledge, from Odoo doc:

type of button, indicates how it clicking it affects Odoo:
workflow (default)
sends a signal to a workflow. The button's name is the workflow signal, the row's record is passed as argument to the signal
call a method on the list's model. The button's name is the method, which is called with the current row's record id and the current context.
load an execute an ir.actions, the button's name is the database id of the action. The context is expanded with the list's model (as active_model), the current row's record (active_id) and all the records currently loaded in the list (active_ids, may be just a subset of the database records matching the current search)

But there is a solution:

The problem is how do you create a server action: if you create it by GUI then you don't have an external ID but just an ID number, while if you create via XML you can use the ID name as a button name and Odoo will assign automatically an ID number.


I have a server action called rest_checkout_send, then on button name I wrote

<button name="%(rest_checkout_send)d" string="Enviar" type="action" attrs="{'invisible':[('status','=','1')]}"/> 

and it was automatically update in

<button name="723" string="Enviar" type="action" attrs="{'invisible':[('status','=','1')]}"/>           	   


About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 7/3/15, 6:10 PM
Seen: 1398 times
Last updated: 7/23/15, 3:52 PM