Odoo - OpenERP - How to Call function on button - How to add functionality on button ?

Support
Support
5000
| 2 1 2
Asked on 8/21/15, 4:55 PM
0
vote
5422 Views

There are three ways to add functionality on buttons in OpenERP/Odoo:

1. Call function directly on button: 

You can directly call the function defined in model/class using type="object" attribute.

<button string="Check availability" name="check_username_availability" type="object" class="oe_highlight" />

In this case you have to define 'check_username_availablilty' function in model.

2. Using Workflow: 

Workflow is the most used functionality in OpenERP/Odoo to process flow of the activity.

Default type of button is workflow i.e type="workflow"

<button string="Accept" name="signal_accept" type="workflow" class="oe_highlight" />

3. Using action: 

You have to use type="action" if you want to call any action defined in the .xml file.

For example if you want to open any wizard you can use following code snippet:

<button name="%(action_id)d" string="Button Label" type="action">

or you can replace %(action_id)d with action id from database.

Reference Links:

http://stackoverflow.com/questions/17462992/how-to-add-simple-func-to-a-button-in-openerp-7

http://stackoverflow.com/questions/14682253/name-of-type-action-in-openerp-button
 

Support
Support
5000
| 2 1 2
Answered on 8/21/15, 4:58 PM
0
vote

Your answer

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!

Ask a Question

Keep Informed

About This Forum

This forum is for HiTechnologia Employees & just Odoo general knowledge purpose only.

Read Guidelines

Question tools

3 follower(s)

Stats

Asked: 8/21/15, 4:55 PM
Seen: 5422 times
Last updated: 8/21/15, 4:58 PM