Skip to content

Commit

Permalink
[MIG][12.0] web_dashboard_tile
Browse files Browse the repository at this point in the history
- refactor tile category
- improve description
- add legalsylvain as maintainer
- update code and translation
  • Loading branch information
legalsylvain committed Aug 2, 2021
1 parent 2d5396b commit 698433e
Show file tree
Hide file tree
Showing 60 changed files with 1,692 additions and 4,178 deletions.
132 changes: 108 additions & 24 deletions web_dashboard_tile/README.rst
Original file line number Diff line number Diff line change
@@ -1,13 +1,31 @@
Dashboard Tiles
===============
==========================
Overview Dashboard (Tiles)
==========================

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-legalsylvain%2Fweb-lightgray.png?logo=github
:target: https://github.com/legalsylvain/web/tree/12.0-mig-web_dashboard_tile/web_dashboard_tile
:alt: legalsylvain/web

|badge1| |badge2| |badge3|

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`.
- Function is one of ``sum``, ``avg``, ``min``, ``max`` or ``median``.
- Field must be integer or float.

Tile can be:
Expand All @@ -18,60 +36,126 @@ Tile can be:

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

**Table of contents**

.. contents::
:local:

Configuration
=============

First, you have to create tile categories.

* Go to "Dashboards > Settings > Dashboard Categories"

* Click on Create

* Set a name, and save.

Odoo menu and action are automatically created.
You should refresh your browser to see new menu items.

.. image:: https://raw.githubusercontent.com/legalsylvain/web/12.0-mig-web_dashboard_tile/web_dashboard_tile/static/description/tile_category_form.png

Then you can create tiles.

* go to "Dashboards > Settings > Dashboard Tiles"

* create a new tile, set a name, a category and a model.

* You can optionally define colors, domain a specific action to use.

* Setting a user, or a group in "Security" tab will restrict the display of the tile.

.. image:: https://raw.githubusercontent.com/legalsylvain/web/12.0-mig-web_dashboard_tile/web_dashboard_tile/static/description/tile_tile_form.png

You can optionanaly define a secondary value, for that purpose :

* Select a field, a function to apply.

* You can define a specific format. (``.format()`` python syntax)

.. image:: https://raw.githubusercontent.com/legalsylvain/web/12.0-mig-web_dashboard_tile/web_dashboard_tile/static/description/tile_tile_form_secondary_value.png


Usage
=====

* Dashboad sample, displaying Sale Orders to invoice:
* Go to "Dashboard > Overview" and select a category

* The tile configured is displayed with the up to date count and average values of the selected domain.

.. image:: https://raw.githubusercontent.com/legalsylvain/web/12.0-mig-web_dashboard_tile/web_dashboard_tile/static/description/tile_tile_kanban.png

* By clicking on the item, you'll navigate to the tree view of the according model.

.. image:: https://raw.githubusercontent.com/legalsylvain/web/12.0-mig-web_dashboard_tile/web_dashboard_tile/static/description/tile_tile_2_tree_view.png

**Note**

When you are in a tree view, with a domain, you can save it in the favorite menu, but the configuration is limited.

.. image:: ./static/src/img/screenshot_dashboard.png
.. image:: https://raw.githubusercontent.com/legalsylvain/web/12.0-mig-web_dashboard_tile/web_dashboard_tile/static/description/favorite_menu_create_tile.png

* Tree view displayed when user click on the tile:

.. image:: ./static/src/img/screenshot_action_click.png
.. image:: https://raw.githubusercontent.com/legalsylvain/web/12.0-mig-web_dashboard_tile/web_dashboard_tile/static/description/favorite_menu_create_tile_result.png

Known issues / Roadmap
======================

**Known issues**

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`).
* 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**

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>`_.
Bugs are tracked on `GitHub Issues <https://github.com/legalsylvain/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**>`_.
If you spotted it first, help us smashing it by providing a detailed and welcomed
`feedback <https://github.com/legalsylvain/web/issues/new?body=module:%20web_dashboard_tile%0Aversion:%2012.0-mig-web_dashboard_tile%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
~~~~~~~

* initOS GmbH & Co. KG
* GRAP

Contributors
------------
~~~~~~~~~~~~

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

Maintainer
----------
Maintainers
~~~~~~~~~~~

.. |maintainer-legalsylvain| image:: https://github.com/legalsylvain.png?size=40px
:target: https://github.com/legalsylvain
:alt: legalsylvain

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

This module is maintained by the OCA.
|maintainer-legalsylvain|

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.
This module is part of the `legalsylvain/web <https://github.com/legalsylvain/web/tree/12.0-mig-web_dashboard_tile/web_dashboard_tile>`_ project on GitHub.

To contribute to this module, please visit http://odoo-community.org.
You are welcome to contribute.
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,15 +1,15 @@
# -*- 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, "
"Odoo Community Association (OCA)",
"maintainers": ["legalsylvain"],
"category": "web",
"license": "AGPL-3",
"contributors": [
Expand All @@ -18,15 +18,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>
Loading

0 comments on commit 698433e

Please sign in to comment.