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.
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!
Current Product Version - 2.0
31 comments
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.
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/
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.
Can I inherit the model board.board and add tree, form or kanban views to the original view mydashboard?
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
I only want to show three user but contains all records.
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
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
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.
File “src/lxml/etree.pyx”, line 3542, in lxml.etree._Validator.assert_
AssertionError: Element odoo has extra content: record, line 5
File “src/lxml/etree.pyx”, line 3542, in lxml.etree._Validator.assert_
AssertionError: Element odoo has extra content: record, line 5
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.
again AssertionError: Element odoo has extra content: record, line 5 This error coming how to solve this please tell me
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.
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
Remove this part from the code:
……………. All the content inside this div ……………..