Skip to content

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&gt;0;wallet:value==0', 'color': 'red:value&gt;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.

Example of a action record
<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

PropertyDescriptionTypeDefaultVersion
action_idAction id to use. See Dashboardinteger (use %(module.xml_id)d)--
heightHeight of the widgetnumber- v2.34.0
widget_propsProps for the widget. See Widget propsobject--

Widget props

PropertyDescriptionTypeDefaultVersion
cardWhether the widget is a cardbooleanfalse-
iconIcon for the widget. See Iconsstring--
suffixSuffix for the valuestring--
colorColor for the valuestring- v2.64.0