Skip to Content
Menu
This question has been flagged
1 Reply
6793 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

Avatar
Discard
Best Answer

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

Avatar
Discard
Related Posts Replies Views Activity
2
Jun 22
8689
3
Dec 23
761
0
Aug 23
765
2
Nov 20
10281
1
Feb 24
7152