Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM | e-Commerce | Accounting | Inventory | PoS | Project management | MRP | etc.
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
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
Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!
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.Register
Odoo Training Center
Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.Test it now
|Asked: 2/7/16, 2:51 PM|
|Seen: 616 times|
|Last updated: 2/7/16, 5:23 PM|