diff --git a/web_dashboard_tile/__openerp__.py b/web_dashboard_tile/__openerp__.py index dbda3d3b7..321d7491e 100644 --- a/web_dashboard_tile/__openerp__.py +++ b/web_dashboard_tile/__openerp__.py @@ -30,6 +30,7 @@ ], 'demo': [ 'demo/res_groups.yml', + 'demo/tile_category.yml', 'demo/tile_tile.yml', ], 'qweb': [ diff --git a/web_dashboard_tile/demo/tile_category.yml b/web_dashboard_tile/demo/tile_category.yml new file mode 100644 index 000000000..5fe1b632b --- /dev/null +++ b/web_dashboard_tile/demo/tile_category.yml @@ -0,0 +1,29 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2015-Today GRAP +# @author Sylvain LE GAL (https://twitter.com/legalsylvain) +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + +- !record {model: tile.category, id: modules}: + name: Modules + sequence: 0 + +- !record {model: tile.category, id: finance}: + name: Finance + sequence: 1 \ No newline at end of file diff --git a/web_dashboard_tile/demo/tile_tile.yml b/web_dashboard_tile/demo/tile_tile.yml index dd9da0165..50cd7b69f 100644 --- a/web_dashboard_tile/demo/tile_tile.yml +++ b/web_dashboard_tile/demo/tile_tile.yml @@ -22,18 +22,21 @@ - !record {model: tile.tile, id: installed_modules}: name: Installed Modules + category_id: modules model_id: base.model_ir_module_module domain: [['state', 'in', ['installed', 'to upgrade', 'to remove']]] action_id: base.open_module_tree - !record {model: tile.tile, id: installed_OCA_modules}: name: Installed OCA Modules + category_id: modules model_id: base.model_ir_module_module domain: [['state', 'in', ['installed', 'to upgrade', 'to remove']], ['author', 'ilike', 'Odoo Community Association (OCA)']] action_id: base.open_module_tree - !record {model: tile.tile, id: all_currency_with_rate}: name: Currencies (Max Rate) + category_id: finance model_id: base.model_res_currency domain: [] secondary_function: max diff --git a/web_dashboard_tile/models/__init__.py b/web_dashboard_tile/models/__init__.py index 97fec216c..3a5158325 100644 --- a/web_dashboard_tile/models/__init__.py +++ b/web_dashboard_tile/models/__init__.py @@ -4,4 +4,4 @@ # © 2015-Today GRAP # License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html -from . import tile_tile +from . import tile_tile, tile_category diff --git a/web_dashboard_tile/models/tile_category.py b/web_dashboard_tile/models/tile_category.py new file mode 100644 index 000000000..5e4d9b2cd --- /dev/null +++ b/web_dashboard_tile/models/tile_category.py @@ -0,0 +1,17 @@ +# -*- coding: utf-8 -*- +# © 2018 Iván Todorovich +# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html + +from openerp import fields, models + + +class TileCategory(models.Model): + _name = 'tile.category' + _description = 'Dashboard Tile Category' + _order = 'sequence asc' + + name = fields.Char(required=True) + sequence = fields.Integer( + help="Used to order the tile categories", + default=0) + fold = fields.Boolean('Folded by default') diff --git a/web_dashboard_tile/models/tile_tile.py b/web_dashboard_tile/models/tile_tile.py index 218cec406..e9e992808 100644 --- a/web_dashboard_tile/models/tile_tile.py +++ b/web_dashboard_tile/models/tile_tile.py @@ -77,6 +77,7 @@ class TileTile(models.Model): # Column Section name = fields.Char(required=True) sequence = fields.Integer(default=0, required=True) + category_id = fields.Many2one('tile.category', 'Category') user_id = fields.Many2one('res.users', 'User') background_color = fields.Char(default='#0E6C7E', oldname='color') font_color = fields.Char(default='#FFFFFF') diff --git a/web_dashboard_tile/security/ir.model.access.csv b/web_dashboard_tile/security/ir.model.access.csv index 3229b4ea2..06448cc99 100644 --- a/web_dashboard_tile/security/ir.model.access.csv +++ b/web_dashboard_tile/security/ir.model.access.csv @@ -1,2 +1,3 @@ id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink tile_user,tile_user,model_tile_tile,base.group_user,1,1,1,1 +tile_user_category,tile_user,model_tile_category,base.group_user,1,1,1,1 diff --git a/web_dashboard_tile/views/tile.xml b/web_dashboard_tile/views/tile.xml index 5221aa410..fa299d12c 100644 --- a/web_dashboard_tile/views/tile.xml +++ b/web_dashboard_tile/views/tile.xml @@ -27,11 +27,14 @@

+ + + + - @@ -85,12 +88,13 @@ - + tile.tile - + + @@ -142,6 +146,28 @@ + + tile.category + +
+ + + +
+
+
+ + + tile.category + + + + + + + + + Dashboard tile.tile