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.
@Umashankar. Short answer: yes. There are 3 types of buttons which is indicated by it's type: worfklow (default and usually not stated), action (type='action'), and object (type='object').
- Object buttons can be used to call the related model's method. The name attribute of the button is the name of the method. A sample of this type of button in OpenERP 7 is "Set to Draft" button of account.invoice. It calls account.invoice's action_cancel_draft method. (For most of the samples I've stated here, you can check addons/account/account_invoice_view.xml and addons/account/account_invoice.py)
- Workflow buttons are used to call a workflow transition. The name attribute of the button is the signal of the workflow transition. A sample of this is "Validate" button of account.invoice. It sends the invoice_open signal to account.invoice's workflow.
- Action buttons are used to call an action. The name attribute of the button is the action's ID (which is represented by the XML ID). A sample of this is "Re-Open" button of account.inoice. It calls the action_account_state_open action, which will open a window of a wizard.
Now, more on the actions, there are at least 4 types of actions, AFAIK: window (which will display a view), report (which will execute a report), clients (which calls a method in client and AFAIK cannot be used properly in buttons), and server (which will execute a method).
So, if you want to call a method from a button, you have 2 alternatives: use an object button, or use an action button that calls a server action. Samples of server action can be found in odoo/addons/stock/wizard/stock_partial_move_view.xml, e.g. action_partial_move_server action calls a code. The action is called by "Process Partially" button in odoo/addons/stock/stock_view.xml.
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: 1/21/15, 4:42 AM|
|Seen: 1227 times|
|Last updated: 4/17/15, 9:28 AM|