Reading list Switch to dark mode

    Creating Odoo Custom Dashboard

    Updated 16 July 2021

    Dashboards in Odoo are useful for visualization of data in a better way. In this article, i am going to explain how to create a custom Dashboard in Odoo. For creating the dashboard follow the steps below.

    • Step 1 :-> For creating a dashboard you need to create a model (custom.sales.dashboard in my case) and add some filed in it like color, name etc based on your requirement.
      class CustomSalesDashboard(models.Model):
          _name = "custom.sales.dashboard"
      
          color = fields.Integer(string='Color Index')
          name = fields.Char(string="Name")
      

    Step 2:-> Create a kanban and form view of this above-created model. You can create a kanban view and customize it as per your requirement. I have created a basic kanban view of the above model.

    <record id="channel_dashboard_kanban_view" model="ir.ui.view">
      <field name="name">custom.sales.dashboard.view</field>
      <field name="model">custom.sales.dashboard</field>
      <field name="arch" type="xml">
        <kanban class="oe_background_grey o_kanban_dashboard o_salesteam_kanban o_project_kanban " create="0">
           <field name="color"/>
           <field name="name"/>
           <templates>
              <span t-name="kanban-box"> <!-- Use <t> tag instead of <span> for color change -->
                 <div t-attf-class="#{kanban_color(record.color.raw_value)} ">
                    <div class="o_project_kanban_manage">
                       <a class="o_kanban_manage_toggle_button" href="#">More
                           <i class="fa fa-caret-down"/>
                        </a>
                    </div>
                    <div class="o_project_kanban_main" >
                      <div class="o_kanban_card_content o_visible">
                          <div class="o_kanban_primary_left" >
                              <div class="">
                                  <center>
                                     <span>
                                        <span t-field="record.name"/>
                                      </span>
                                  </center>
                               </div>
                                <div>
                                <center>
                                   <button class="btn btn-primary" type="action" name="dashboard_sales_action_id" string="Quotations">Quotations</button>
                                        <button class="btn btn-primary" type="action" name="dashboard_sales_order_action_id" >Sales order</button>
                                        <h3>Custom Dashboard for Sales</h3>
                                   </center>
                                    </div>
                                </div>
                            </div>
                         <div class="o_kanban_card_manage_pane o_invisible">
                             <div class="col-xs-6 o_kanban_card_manage_section o_kanban_manage_view">
                                 <div class="o_kanban_card_manage_title">
                                     <span>View</span>
                                 </div>
                                </div>
                              <div t-if="widget.editable" class="o_project_kanban_colorpicker" >
                                <ul class="oe_kanban_colorpicker" data-field="color"/>
                              </div>
                         </div>
                       </div>
                    </div>
                </span>
            </templates>
        </kanban>
      </field>
    </record>
     <record id="channel_dashboard_form_view" model="ir.ui.view">
          <field name="name">custom.sales.dashboard.form.view</field>
          <field name="model">custom.sales.dashboard</field>
         <field name="arch" type="xml">
               <form>
                   <field name="color"/>
                   <field name="name"/>
              </form>
         </field>
     </record>
    • Step 3 :-> Create the action of the above view.
      <record id="custom_sales_dashboard_action" model="ir.actions.act_window">
          <field name="name">Dashboard</field>
          <field name="res_model">custom.sales.dashboard</field>
          <field name="type">ir.actions.act_window</field>
          <field name="view_type">form</field>
          <field name="context">{}</field>
          <field name="view_mode">kanban,form</field>
      </record>
      
    • Step 4:-> Create the Menu for this action.
      <menuitem id="menu_sales_config_inherited" parent= "sales_team.menu_sale_config" sequence= "1" name= "Sales Test dashboard" action="custom_sales_dashboard_action"/>
    • This is all for creating a basic dashboard, now your dashboard is ready to use.IMg1

    This blog has been updated and I hope all of you there who faced any kind of issue you can try it again now. I have created the form view also that you can create a record also for the test purpose.

    For odoo12 dashboard Visit this link:  https://webkul.com/blog/custom-dashboard-odoo12/

    That is it.!!!
    If you liked this post, It would be very grateful if you write your opinions, comments and suggestions to keep the post updated and interesting.
    Thank you!

    Searching for an experienced
    Odoo Company ?
    Find out More

    Current Product Version - 2.0

    . . .

    Leave a Comment

    Your email address will not be published. Required fields are marked*


    31 comments

  • Ali Mughal
    thank Jahangir Naik above link working dashboard shows as a given picture. Problem is that how can I show the graph in kanban view in the dashboard
    • Jahangir Naik (Moderator)
      You can simply create a dashboard by simply adding a field like this.
      kanban_dashboard_graph, should have some list of dictionaries like
      [{“title”: “”, “color”: “#7c7bad”, “values”: [{“label”: “Past”, “value”: 0.0}, {“label”: “29 Sep-5 Oct”, “value”: 0.0, “type”: “past”}, {“label”: “This Week”, “value”: 0.0, “type”: “future”}, {“label”: “Future”, “value”: 0.0, “type”: “future”}], “key”: “EXPORT”, “area”: true}]

      I am writing a full blog on this once I will be done with that I will share the link with you.

  • Ali Mughal
    according to above instruction i run the code in my custome module after installing he module its not give me proper result top bar with name of configuration and side bar with name of Sale Test dashboard. how data come in to dashboeard.?
    • Jahangir Naik (Moderator)
      Hi Ali,
      You have to create a simple model with a form and a tree view. you can create the records in that model and for kanban, you can simply create the above dashboard.

      You can get help from this link:
      https://webkul.com/blog/custom-dashboard-odoo12/

      • Ali Mughal
        thank Jahangir Naik above link working dashboard shows as given picture.Problem is that how can I show the graph in kanban view in the dashboard
        • Jahangir Naik (Moderator)
          You can simply create a dashboard by simply adding a field like this.

          kanban_dashboard_graph, should have some list of dictionaries like
          [{“title”: “”, “color”: “#7c7bad”, “values”: [{“label”: “Past”, “value”: 0.0}, {“label”: “29 Sep-5 Oct”, “value”: 0.0, “type”: “past”}, {“label”: “This Week”, “value”: 0.0, “type”: “future”}, {“label”: “Future”, “value”: 0.0, “type”: “future”}], “key”: “EXPORT”, “area”: true}]

          I am writing a full blog on this once I will be done with that I will share the link with you.

  • Fazal Haleem
    You haven’t mention where and how to create the first record for dashboard
    • Jahangir Naik (Moderator)
      In order to create a record, you can simply create a tree or form view and create a record.
  • Sapphire
    Hi,
    Can I inherit the model board.board and add tree, form or kanban views to the original view mydashboard?
    • Jahangir Naik (Moderator)
      Yes, you can inherit and add the views in board.board, but for creating the dashboard for some other model there will be no use of it.
      • Sapphire
        I want to complete it through customer dashboard,but for creating kanban view that should be group by user.For example,I have three users, so i want to create only one kanban view for each of them.This is difficult for me, give me some suggestions, thanks a lot. Maybe next time I will have to consider the authorities.
        • Jahangir Naik (Moderator)
          IF you want to create only there records. then you can simply create a kanban view and add the information in the kanban view you want to show.

          If you have multiple records but the users can be only three and you want to group by them on the basis of them you can do it in the same way but add the group by using the user.
          https://prnt.sc/n9w2kn

          • Sapphire
            I see, but if I group by this model,there are so many records for every user,this is not my purpose.
            I only want to show three user but contains all records.
          • Jahangir Naik (Moderator)
            You can create a ticket contact us [email protected] we can discuss the requirement in detail.
  • anaibi saber
    on peut utiliser la balise
  • Jahangir Naik (Moderator)
    There might be some issue with the format of the of the kanban view. Please check all the classes that you have used(especially kanban classes).
  • Sreekanth
    Hi Jahangir,
    I ended up with a Blank page trying to create the dashboard. Not really able to figure where i went wrong. I use odoo 10 CE.

    My kanban code:

    sales_cockpit_kanban_view
    sales.cockpit.dashboard

    More

    pipeline Seeding
    pipeline Development
    Custom Dashboard for Sales

    View

    pipeline Seeding

    pipeline Development


    pipeline Seeding


    pipeline Development

    • Jahangir Naik (Moderator)
      There might be some issue with the format of the of the kanban view. Please check all the classes that you have used(especially kanban classes).
    • Jahangir Naik (Moderator)
      The blog has been updated now. You should have a record in order to view the dashboard. I have created the form view also now so that you can create a new record also.
    • Jahangir Naik (Moderator)
      @Sreekanth. I think there is no record created at the moment. You can create a record simply and I hope then you will be able to see the kanban(Dashboard) view.
  • Arun
    I gave
    Also again
    File “src/lxml/lxml.etree.pyx”, line 3501, in lxml.etree._Validator.assert_ (src/lxml/lxml.etree.c:184715)
    AssertionError: Element odoo has extra content: record, line 5
    this error coming How to solve this please explain it in odoo11
    • Jahangir Naik (Moderator)
      Please copy the code as it is, if the error is still there then remove the “span” tag with a “t” tag.
      For example ,

      Simply replace above line as(closing tags also):

      Note:-;
      I have displayed some information (count of the orders in different states) and you have to create these actions. If you don’t not want to display this information then you have to remove these action ids. Other wise you need to create these actions.

  • Prakash
    please refactoring your code..
    • Jahangir Naik (Moderator)
      I will update this in the next version of this post.
  • Anand
    Resulting in error-

    File “src/lxml/etree.pyx”, line 3542, in lxml.etree._Validator.assert_
    AssertionError: Element odoo has extra content: record, line 5

  • Anand
    Resulting in error-

    File “src/lxml/etree.pyx”, line 3542, in lxml.etree._Validator.assert_
    AssertionError: Element odoo has extra content: record, line 5

    • Jahangir Naik (Moderator)
      Please copy the code as it is, if the error is still there then remove the “span” tag with a “t” tag.

      For example ,
      <span t-name=”kanban-box”>

      Simply replace above line as(closing tags also):
      <t t-name=”kanban-box”>

      Note:-;
      I have displayed some information (count of the orders in different states) and you have to create these actions. If you don’t not want to display this information then you have to remove these action ids. Other wise you need to create these actions.

      • Arun
        I gave

        again AssertionError: Element odoo has extra content: record, line 5 This error coming how to solve this please tell me

      • Jahangir Naik (Moderator)
        Please copy the code as it is, if the error is still there then remove the “span” tag with a “t” tag.
        For example ,

        Simply replace above line as(closing tags also):

        Note:-;
        I have displayed some information (count of the orders in different states) and you have to create these actions. If you don’t not want to display this information then you have to remove these action ids. Other wise you need to create these actions.

  • Mohamed Fouad
    i had this error

    raise ValueError(‘External ID not found in the system: %s’ % xmlid)
    ParseError: “External ID not found in the system: dashboard.dashboard_sales_action_id” while parsing /home/mohamed/PycharmProjects/odoo10/custom_addons/dashboard/views/views.xml:3, near

    • Jahangir Naik
      This is because I have displayed some information (count of the orders in different states) and you have to create these actions. If you don’t not want to display this information or you want to remove the error you are getting then you have to remove these action ids.

      Remove this part from the code:

      ……………. All the content inside this div ……………..

  • Back to Top

    Message Sent!

    If you have more details or questions, you can reply to the received confirmation email.

    Back to Home