Chapter 6 - Odoo 15 Development Book

Dashboard view

Dashboard view is used to show multiple views and the various business KPIs in a single screen. If we are using Dashboard view, we should specify ‘web_dashboard’ in the dependency in manifest. This view is only available for enterprise version.

Let’s take an example, in this example let’s create a dashboard view of helpdesk. Ticket which will show the pivot and graph view of the tickets.

<record id="view_helpdesk_dashboard" model="ir.ui.view">
    <field name="name">Hepldesk dashbaord</field>
    <field name="model">helpdesk.ticket</field>
    <field name="arch" type="xml">
        <dashboard>
            <view ref="helpdesk.helpdesk_ticket_view_graph_analysis"
                     type="graph"/>
            <group>
              <aggregate name="all_ticket"
                  string="Total Ticket"
                  group_operator="count"
                  field="id" measure="__count__"/>
                   <aggregate name="progress_tikets"
                              string="In Progress Ticket" domain="[('stage_id.name', 'ilike',
                              'In Progress')]"
                              group_operator="count"
                              field="id" measure="__count__"/>
                   <aggregate name="done_ticket"
                              string="Done Ticket"
                              domain="[('stage_id.name', 'ilike',
                              'Done')]"
                              group_operator="count" field="id"
                              measure="__count__"/>
                   <formula name="average"
                            string="Overall Progress"
                            value="record.done_ticket / record.all_ticket"
                            widget="percentage"/>
            </group>
            <view ref="helpdesk.helpdesk_ticket_view_pivot_analysis"
                     type="pivot"/>
        </dashboard>
    </field>
</record>

Let’s add an action and menu for this view:

<record id="act_window_dashboard" model="ir.actions.act_window">
    <field name="name">Dashboard of tickets</field>
    <field name="type">ir.actions.act_window</field>
    <field name="res_model">helpdesk.ticket</field>
    <field name="view_mode">dashboard</field>
</record>
<menuitem id="dashoard_ticket_menu"
    name="Dashboard"
    parent="helpdesk.helpdesk_ticket_report_menu_main"
    action="act_window_dashboard"
    sequence="28"/>

In the dashboard view, we can show multiple view and the KPIs using aggregate and formula. In this view, it is showing pivot and graph of helpdesk.ticket. To specify this views, we will give these views XML reference in the <view> tag’s ref attribute.

Here we are showing different KPIs such as the count of all tickets, the tickets in progress and the tickets that are done using the <aggregate> tag. In this view we have also shown the progress of the tickets in percentage using <formula>

whatsapp_icon
location

Calicut

Cybrosys Technologies Pvt. Ltd.
Neospace, Kinfra Techno Park
Kakkancherry, Calicut
Kerala, India - 673635

location

Kochi

Cybrosys Technologies Pvt. Ltd.
1st Floor, Thapasya Building,
Infopark, Kakkanad,
Kochi, India - 682030.

location

Bangalore

Cybrosys Techno Solutions
The Estate, 8th Floor,
Dickenson Road,
Bangalore, India - 560042

Send Us A Message