Indicator
Indicator for field
Available for fields of type text
char
, float
, integer
, selection
, many2one
, date*
<field name="total_debit" widget="indicator" />
Total debit
1,000
With a card icon and suffix
<field name="total_debit" widget="indicator" widget_props="{'card': true, 'icon': 'dollar', 'suffix': 'USD'}" />
Total debit
1,000USD
With a dynamic icon and color
v2.64.0
You can use conditions syntax with icon
and color
properties.
<field name="total_debit" widget="indicator" widget_props="{'icon': 'warning:value>0;wallet:value==0', 'color': 'red:value>0;green:value==0'}"/>
Total debit
1,000USD
Indicator for dashboard in the form
You can use the panels of the dashboard inside a form
and you can use any field
from the form in the domain of the action for this indicator.
<record model="ir.actions.act_window" id="action_poweremail_mailbox_error"> <field name="name">Emails in error folder</field> <field name="type">ir.actions.act_window</field> <field name="res_model">poweremail.mailbox</field> <field name="view_type">form</field> <field name="domain">[('folder','=','error'),('pem_account_id','=',active_id)]</field> <field name="context">{}</field> <field name="view_mode">graph,tree,form</field></record>
In this case we use active_id
to filer only the records where pem_account_id
is the current record of the form.
Then in the form you can use this action with the indicator
widget:
<indicator action_id="%(action_poweremail_mailbox_error)d" />
If you want a more integrated indicator in your form, you can also use the widget_props="{'card': true}"
to show it as a card.
v2.58.0
<indicator action_id="%(action_poweremail_mailbox_error)d" widget_props="{'card': true}" />
A full example in this pull-request Add indicators to poweremail.core_accounts form #161.
API
Property | Description | Type | Default | Version |
---|---|---|---|---|
action_id | Action id to use. See Dashboard | integer (use %(module.xml_id)d) | - | - |
height | Height of the widget | number | - | v2.34.0 |
widget_props | Props for the widget. See Widget props | object | - | - |
Widget props
Property | Description | Type | Default | Version |
---|---|---|---|---|
card | Whether the widget is a card | boolean | false | - |
icon | Icon for the widget. See Icons | string | - | - |
suffix | Suffix for the value | string | - | - |
color | Color for the value | string | - | v2.64.0 |