Skip to content

Commit

Permalink
[MIG] web_dashboard_tile
Browse files Browse the repository at this point in the history
  • Loading branch information
legalsylvain committed Sep 10, 2020
1 parent a61583e commit 8f7edfe
Show file tree
Hide file tree
Showing 52 changed files with 994 additions and 4,213 deletions.
77 changes: 0 additions & 77 deletions web_dashboard_tile/README.rst
Original file line number Diff line number Diff line change
@@ -1,77 +0,0 @@
Dashboard Tiles
===============

Adds a dashboard where you can configure tiles from any view and add them as short cut.

By default, the tile displays items count of a given model restricted to a given domain.

Optionally, the tile can display the result of a function on a field.

- Function is one of `sum`, `avg`, `min`, `max` or `median`.
- Field must be integer or float.

Tile can be:

- Displayed only for a user.
- Global for all users.
- Restricted to some groups.

*Note: The tile will be hidden if the current user doesn't have access to the given model.*

Usage
=====

* Dashboad sample, displaying Sale Orders to invoice:

.. image:: ./static/src/img/screenshot_dashboard.png

* Tree view displayed when user click on the tile:

.. image:: ./static/src/img/screenshot_action_click.png

Known issues
============
* Can not edit color from dashboard
* Original context is ignored.
* Original domain and filter are not restored.
* To preserve a relative date domain, you have to manually edit the tile's domain from `Configuration > User Interface > Dashboard Tile`. You can use the same variables available in filters (`uid`, `context_today()`, `current_date`, `time`, `datetime`, `relativedelta`).

Roadmap
=======
* Add icons.
* Support client side action (like inbox).
* Restore original Domain + Filter when an action is set.
* Posibility to hide the tile based on a field expression.
* Posibility to set the background color based on a field expression.

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/web/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed feedback
`here <https://github.com/OCA/web/issues/new?body=module:%20web_dashboard_tile%0Aversion:%208.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.


Credits
=======

Contributors
------------

* Markus Schneider <markus.schneider at initos.com>
* Sylvain Le Gal (https://twitter.com/legalsylvain)
* Iván Todorovich <[email protected]>

Maintainer
----------

.. image:: http://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: http://odoo-community.org

This module is maintained by the OCA.

OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.

To contribute to this module, please visit http://odoo-community.org.
7 changes: 1 addition & 6 deletions web_dashboard_tile/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,2 @@
# -*- coding: utf-8 -*-
# © 2010-2013 OpenERP s.a. (<http://openerp.com>).
# © 2014 initOS GmbH & Co. KG (<http://www.initos.com>).
# © 2015-Today GRAP
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html

from . import controllers
from . import models
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
# -*- coding: utf-8 -*-
# © 2010-2013 OpenERP s.a. (<http://openerp.com>).
# © 2014 initOS GmbH & Co. KG (<http://www.initos.com>).
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
{
"name": "Dashboard Tile",
"summary": "Add Tiles to Dashboard",
"version": "9.0.1.1.0",
"name": "Overview Dashboard (Tiles)",
"summary": "Add Overview Dashboards with Tiles",
"version": "12.0.1.0.0",
"depends": ["web", "board", "mail", "web_widget_color"],
"author": "initOS GmbH & Co. KG, "
"GRAP, "
Expand All @@ -18,15 +17,16 @@
"Iván Todorovich <[email protected]>",
],
"data": [
"views/tile.xml",
"views/templates.xml",
"security/ir.model.access.csv",
"security/rules.xml",
"security/ir_rule.xml",
"views/menu.xml",
"views/tile_tile.xml",
"views/tile_category.xml",
"views/templates.xml",
],
"demo": [
"demo/res_groups.yml",
"demo/tile_category.yml",
"demo/tile_tile.yml",
"demo/tile_category.xml",
"demo/tile_tile.xml",
],
"qweb": ["static/src/xml/custom_xml.xml"],
"qweb": ["static/src/xml/web_dashboard_tile.xml"],
}
1 change: 1 addition & 0 deletions web_dashboard_tile/controllers/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import main
15 changes: 15 additions & 0 deletions web_dashboard_tile/controllers/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright (C) 2019-Today: GTRAP (<http://www.grap.coop/>)
# @author: Sylvain LE GAL (https://twitter.com/legalsylvain)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from odoo.http import Controller, route, request


class WebDashboardTile(Controller):

@route('/web_dashboard_tile/create_tile', type='json', auth='user')
def create_tile(self, model_name, *args, **kwargs):
IrModel = request.env['ir.model']
model = IrModel.search([('model', '=', model_name)])
kwargs.update({'model_id': model.id})
return request.env['tile.tile'].create(kwargs)
25 changes: 0 additions & 25 deletions web_dashboard_tile/demo/res_groups.yml

This file was deleted.

16 changes: 16 additions & 0 deletions web_dashboard_tile/demo/tile_category.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>

<record id="category_module" model="tile.category">
<field name="name">Modules</field>
<field name="sequence">1</field>
<field name="active" eval="True"/>
</record>

<record id="category_currency" model="tile.category">
<field name="name">Currencies</field>
<field name="sequence">2</field>
<field name="active" eval="True"/>
</record>

</odoo>
29 changes: 0 additions & 29 deletions web_dashboard_tile/demo/tile_category.yml

This file was deleted.

29 changes: 29 additions & 0 deletions web_dashboard_tile/demo/tile_tile.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>

<record id="installed_modules" model="tile.tile">
<field name="name">Installed Modules</field>
<field name="category_id" ref="category_module"/>
<field name="model_id" ref="base.model_ir_module_module"/>
<field name="action_id" ref="base.open_module_tree"/>
<field name="domain">[['state', 'in', ['installed', 'to upgrade', 'to remove']]]</field>
</record>

<record id="installed_OCA_modules" model="tile.tile">
<field name="name">Installed OCA Modules</field>
<field name="category_id" ref="category_module"/>
<field name="model_id" ref="base.model_ir_module_module"/>
<field name="action_id" ref="base.open_module_tree"/>
<field name="domain">[['state', 'in', ['installed', 'to upgrade', 'to remove']], ['author', 'ilike', 'Odoo Community Association (OCA)']]</field>
</record>

<record id="all_currency_with_rate" model="tile.tile">
<field name="name">Currencies (Max Rate)</field>
<field name="category_id" ref="category_currency"/>
<field name="model_id" ref="base.model_res_currency"/>
<field name="secondary_function">max</field>
<field name="secondary_field_id" ref="base.field_res_currency__rate"/>
<field name="domain">[]</field>
</record>

</odoo>
43 changes: 0 additions & 43 deletions web_dashboard_tile/demo/tile_tile.yml

This file was deleted.

Loading

0 comments on commit 8f7edfe

Please sign in to comment.