Action Buttons
The action_buttons widget displays a collection of buttons that can execute actions or methods dynamically. The buttons are defined as a JSON array stored in a field value, allowing for flexible button configurations that can be generated programmatically.
This widget is useful when you need to display multiple actions that depend on the current record’s data or business logic.
Basic usage
<field name="button_actions" widget="action_buttons" />The field should contain a JSON array with button definitions.
With label and icon
You can display a fieldset with a label and icon:
<field name="button_actions" widget="action_buttons" string="Available Actions" icon="star" widget_props="{'col': 2}" />Multiple columns layout
Use the col property in widget_props to display buttons in multiple columns:
<field name="button_actions" widget="action_buttons" widget_props="{'col': 2}" />Button definition structure
Each button in the array can have the following properties:
Action button
Executes an OpenERP action (opens a window, form, tree, etc.):
{ "name": "Button Label", "icon": "play-circle", "action": { "type": "ir.actions.act_window", "res_model": "model.name", "view_mode": "form", "res_id": 123, "view_id": 456 }}Action button with ID
You can reference an existing action by ID. The widget will fetch the action details from the server:
{ "name": "Open Wizard", "icon": "magic", "action": { "id": 123, "res_id": 456 }}Method button
Executes a method on a model:
{ "name": "Execute Method", "icon": "setting", "method": { "name": "method_name", "res_model": "model.name", "args": [] }}API
| Property | Description | Type | Default | Version |
|---|---|---|---|---|
string | Label for the fieldset (optional) | string | - | - |
icon | Icon for the fieldset. See Icons | string | - | - |
widget_props | Props for the widget. See Widget props | object | - | - |
Widget props
| Property | Description | Type | Default | Version |
|---|---|---|---|---|
col | Number of columns for button layout | number | 1 | - |