Browse Source
Merge pull request #507 from adhoc-dev/9.0-mig-web_dashboard_tile
Merge pull request #507 from adhoc-dev/9.0-mig-web_dashboard_tile
9.0 mig web dashboard tilepull/856/head
Moises Lopez - https://www.vauxoo.com/
7 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 508 additions and 286 deletions
-
64web_dashboard_tile/README.rst
-
27web_dashboard_tile/__init__.py
-
36web_dashboard_tile/__openerp__.py
-
4web_dashboard_tile/demo/tile_tile.yml
-
13web_dashboard_tile/migrations/8.0.3.0/post-migration.py
-
26web_dashboard_tile/migrations/8.0.4.0/post-migration.py
-
24web_dashboard_tile/models/__init__.py
-
364web_dashboard_tile/models/tile_tile.py
-
11web_dashboard_tile/security/rules.xml
-
55web_dashboard_tile/static/src/css/tile.css
-
BINweb_dashboard_tile/static/src/img/screenshot_dashboard.png
-
15web_dashboard_tile/static/src/js/custom_js.js
-
2web_dashboard_tile/static/src/xml/custom_xml.xml
-
6web_dashboard_tile/tests/__init__.py
-
52web_dashboard_tile/tests/test_tile.py
-
95web_dashboard_tile/views/tile.xml
@ -1,26 +1,7 @@ |
|||||
# -*- coding: utf-8 -*- |
# -*- coding: utf-8 -*- |
||||
############################################################################## |
|
||||
# |
|
||||
# OpenERP, Open Source Management Solution |
|
||||
# Copyright (C) 2010-2013 OpenERP s.a. (<http://openerp.com>). |
|
||||
# Copyright (C) 2014 initOS GmbH & Co. KG (<http://www.initos.com>). |
|
||||
# Copyright (C) 2015-Today GRAP |
|
||||
# Author Markus Schneider <markus.schneider at initos.com> |
|
||||
# @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 <http://www.gnu.org/licenses/>. |
|
||||
# |
|
||||
############################################################################## |
|
||||
|
# © 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 models |
from . import models |
@ -0,0 +1,13 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
# © 2016 Iván Todorovich <ivan.todorovich@gmail.com> |
||||
|
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html |
||||
|
|
||||
|
|
||||
|
def migrate(cr, version): |
||||
|
if version is None: |
||||
|
return |
||||
|
|
||||
|
# Rename old fields |
||||
|
cr.execute("""UPDATE tile_tile SET primary_function = 'count'""") |
||||
|
cr.execute("""UPDATE tile_tile SET secondary_function = field_function""") |
||||
|
cr.execute("""UPDATE tile_tile SET secondary_field_id = field_id""") |
@ -0,0 +1,26 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
# © 2016 Iván Todorovich <ivan.todorovich@gmail.com> |
||||
|
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html |
||||
|
|
||||
|
|
||||
|
def migrate(cr, version): |
||||
|
if version is None: |
||||
|
return |
||||
|
|
||||
|
# Update ir.rule |
||||
|
cr.execute(""" |
||||
|
SELECT res_id FROM ir_model_data |
||||
|
WHERE name = 'model_tile_rule' |
||||
|
AND module = 'web_dashboard_tile'""") |
||||
|
rule_id = cr.fetchone()[0] |
||||
|
new_domain = """[ |
||||
|
"|", |
||||
|
("user_id","=",user.id), |
||||
|
("user_id","=",False), |
||||
|
"|", |
||||
|
("group_ids","=",False), |
||||
|
("group_ids","in",[g.id for g in user.groups_id]), |
||||
|
]""" |
||||
|
cr.execute(""" |
||||
|
UPDATE ir_rule SET domain_force = '%(domain)s' |
||||
|
WHERE id = '%(id)s' """ % {'domain': new_domain, 'id': rule_id}) |
@ -1,23 +1,7 @@ |
|||||
# -*- coding: utf-8 -*- |
# -*- 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 <http://www.gnu.org/licenses/>. |
|
||||
# |
|
||||
############################################################################## |
|
||||
|
# © 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 tile_tile |
from . import tile_tile |
@ -1,44 +1,59 @@ |
|||||
.openerp .oe_kanban_view .oe_dashbaord_tile{ |
|
||||
|
.openerp .oe_kanban_view .oe_dashboard_tile { |
||||
width: 150px; |
width: 150px; |
||||
height: 150px; |
height: 150px; |
||||
border: 0; |
border: 0; |
||||
border-radius: 0; |
border-radius: 0; |
||||
} |
} |
||||
|
|
||||
.openerp .oe_kanban_view .oe_dashbaord_tile .tile_label, |
|
||||
.openerp .oe_kanban_view .oe_dashbaord_tile .tile_count_without_computed_value, |
|
||||
.openerp .oe_kanban_view .oe_dashbaord_tile .tile_count_with_computed_value, |
|
||||
.openerp .oe_kanban_view .oe_dashbaord_tile .tile_computed_value { |
|
||||
width: 140px; |
|
||||
|
/* Disable default kanban style */ |
||||
|
.openerp .oe_kanban_view .oe_dashboard_tile .oe_kanban_content div:first-child { |
||||
|
margin-right: inherit!important; |
||||
|
} |
||||
|
|
||||
|
.openerp .oe_kanban_view .oe_dashboard_tile .tile_label, |
||||
|
.openerp .oe_kanban_view .oe_dashboard_tile .tile_primary_value, |
||||
|
.openerp .oe_kanban_view .oe_dashboard_tile .tile_secondary_value { |
||||
text-align: center; |
text-align: center; |
||||
|
font-weight: bold; |
||||
} |
} |
||||
|
|
||||
.openerp .oe_kanban_view .oe_dashbaord_tile .tile_label{ |
|
||||
|
.openerp .oe_kanban_view .oe_dashboard_tile .tile_label { |
||||
padding: 5px; |
padding: 5px; |
||||
font-size: 15px; |
font-size: 15px; |
||||
} |
} |
||||
|
|
||||
.openerp .oe_kanban_view .oe_dashbaord_tile .tile_count_without_computed_value{ |
|
||||
font-size: 52px; |
|
||||
font-weight: bold; |
|
||||
|
.openerp .oe_kanban_view .oe_dashboard_tile .tile_primary_value{ |
||||
|
font-size: 54px; |
||||
position: absolute; |
position: absolute; |
||||
left: 5px; |
left: 5px; |
||||
|
right: 5px; |
||||
bottom: 5px; |
bottom: 5px; |
||||
} |
} |
||||
|
|
||||
.openerp .oe_kanban_view .oe_dashbaord_tile .tile_count_with_computed_value{ |
|
||||
font-size: 38px; |
|
||||
font-weight: bold; |
|
||||
|
.openerp .oe_kanban_view .oe_dashboard_tile .tile_secondary_value{ |
||||
|
display: none; |
||||
|
font-size: 18px; |
||||
|
font-style: italic; |
||||
position: absolute; |
position: absolute; |
||||
left: 5px; |
left: 5px; |
||||
|
right: 5px; |
||||
|
bottom: 5px; |
||||
|
} |
||||
|
|
||||
|
.openerp .oe_kanban_view .oe_dashboard_tile .with_secondary .tile_primary_value{ |
||||
|
font-size: 38px; |
||||
bottom: 30px; |
bottom: 30px; |
||||
} |
} |
||||
|
|
||||
.openerp .oe_kanban_view .oe_dashbaord_tile .tile_computed_value{ |
|
||||
font-size: 18px; |
|
||||
font-weight: bold; |
|
||||
position: absolute; |
|
||||
right: 10px; |
|
||||
bottom: 5px; |
|
||||
font-style: italic; |
|
||||
|
.openerp .oe_kanban_view .oe_dashboard_tile .with_secondary .tile_secondary_value{ |
||||
|
display: block; |
||||
|
} |
||||
|
|
||||
|
/* SearchView Drawer */ |
||||
|
.openerp .oe_searchview_drawer .oe_searchview_dashboard .oe_dashboard_tile_form { |
||||
|
display: none; |
||||
|
} |
||||
|
|
||||
|
.openerp .oe_searchview_drawer .oe_opened .oe_dashboard_tile_form { |
||||
|
display: block; |
||||
} |
} |
Before Width: 796 | Height: 162 | Size: 45 KiB After Width: 771 | Height: 155 | Size: 20 KiB |
@ -0,0 +1,6 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
# © 2016 Antonio Espinosa - <antonio.espinosa@tecnativa.com> |
||||
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). |
||||
|
# flake8: noqa |
||||
|
|
||||
|
from . import test_tile |
@ -0,0 +1,52 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
# © 2016 Antonio Espinosa - <antonio.espinosa@tecnativa.com> |
||||
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). |
||||
|
|
||||
|
from openerp.tests.common import TransactionCase |
||||
|
|
||||
|
|
||||
|
class TestTile(TransactionCase): |
||||
|
def test_tile(self): |
||||
|
tile_obj = self.env['tile.tile'] |
||||
|
model_id = self.env['ir.model'].search([ |
||||
|
('model', '=', 'tile.tile')]) |
||||
|
field_id = self.env['ir.model.fields'].search([ |
||||
|
('model_id', '=', model_id.id), |
||||
|
('name', '=', 'sequence')]) |
||||
|
self.tile1 = tile_obj.create({ |
||||
|
'name': 'Count / Sum', |
||||
|
'sequence': 1, |
||||
|
'model_id': model_id.id, |
||||
|
'domain': "[('model_id', '=', %d)]" % model_id.id, |
||||
|
'secondary_function': 'sum', |
||||
|
'secondary_field_id': field_id.id}) |
||||
|
self.tile2 = tile_obj.create({ |
||||
|
'name': 'Min / Max', |
||||
|
'sequence': 2, |
||||
|
'model_id': model_id.id, |
||||
|
'domain': "[('model_id', '=', %d)]" % model_id.id, |
||||
|
'primary_function': 'min', |
||||
|
'primary_field_id': field_id.id, |
||||
|
'secondary_function': 'max', |
||||
|
'secondary_field_id': field_id.id}) |
||||
|
self.tile3 = tile_obj.create({ |
||||
|
'name': 'Avg / Median', |
||||
|
'sequence': 3, |
||||
|
'model_id': model_id.id, |
||||
|
'domain': "[('model_id', '=', %d)]" % model_id.id, |
||||
|
'primary_function': 'avg', |
||||
|
'primary_field_id': field_id.id, |
||||
|
'secondary_function': 'median', |
||||
|
'secondary_field_id': field_id.id}) |
||||
|
# count |
||||
|
self.assertEqual(self.tile1.primary_value, '3') |
||||
|
# sum |
||||
|
self.assertEqual(self.tile1.secondary_value, '6') |
||||
|
# min |
||||
|
self.assertEqual(self.tile2.primary_value, '1') |
||||
|
# max |
||||
|
self.assertEqual(self.tile2.secondary_value, '3') |
||||
|
# average |
||||
|
self.assertEqual(self.tile3.primary_value, '2') |
||||
|
# median |
||||
|
self.assertEqual(self.tile3.secondary_value, '2.0') |
Write
Preview
Loading…
Cancel
Save
Reference in new issue