There are three ways to add functionality on button in OpenERP/Odoo:
1. Call function directly on button: You can directly call the function defined in model/class using type="object" attribute.
i.e
<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". Workflow itself is an vital topic so can't talk much about this here.
<button string="Accept" name="signal_accept" type="workflow" class="oe_highlight" />
3. Using action: You have to user 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
Thanks!!!!!!!!!! Enjoy Programming :)
1. Call function directly on button: You can directly call the function defined in model/class using type="object" attribute.
i.e
<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". Workflow itself is an vital topic so can't talk much about this here.
<button string="Accept" name="signal_accept" type="workflow" class="oe_highlight" />
3. Using action: You have to user 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
Thanks!!!!!!!!!! Enjoy Programming :)
I tried all the 3 methods, but my function is not being called...
ReplyDelete