Odoo Help


Where does a button view take its arguments to throw a method?

Pascal Tremblay
on 2/7/16, 2:51 PM 1,032 views

Hello all,

I know that if I click on this button, it throws the method button_proforma_voucher. But the

For example, button_proforma_voucher method takes 5 arguments. Where does the button view take its arguments to throw the associated method?

In the view :

<button name="button_proforma_voucher" string="Register Payment" class="oe_highlight" type="object"/> 

In the python code, the method has already ids value. Where does it take thid ids? :

def button_proforma_voucher(self, cr, uid, ids, context=None):

    _logger.error(" ids :: %s", str(ids))

Thanks to help

Axel Mendoza
On 2/7/16, 5:23 PM

Hi #Pascal

A button is not more that a way to execute an action call on the server, so if you wanna trace where the args are builded to call your button method you could see at do_execute_action function of /openerp/addons/web/static/src/js/views.js

Depending on the button action type it will be how the args get retrieved, for example a button type="object" it will call to the url "/web/dataset/call_button" that trigger the controller method call_button of the DataSet controller at /openerp/addons/web/controllers/main.py. A button type="action" it will call to the url "/web/action/load" that trigger the controller method load of the Action controller at /openerp/addons/web/controllers/main.py. For the workflow button type it will call to the url "/web/dataset/exec_workflow" that trigger the controller method exec_workflow of the DataSet controller at /openerp/addons/web/controllers/main.py

In your case it's a type="object" you could find that the [cr, uid] args get passed by the _call_kw method and the rest of the args came from the js function do_execute_action where for the type="object" it collect the record_id and the context to send it to the call_button url

Hope this helps to clarify the topic

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: 2/7/16, 2:51 PM
Seen: 1032 times
Last updated: 2/7/16, 5:23 PM