Zum Inhalt springen
Menü
Sie müssen registriert sein, um mit der Community zu interagieren.
Diese Frage wurde gekennzeichnet
1 Antworten
7924 Ansichten

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
Verwerfen
Beste Antwort

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
Verwerfen
Verknüpfte Beiträge Antworten Ansichten Aktivität
2
Juni 22
9998
3
Dez. 23
2705
0
Aug. 23
1855
2
Nov. 20
11611
1
Feb. 24
8112