forked from Techsystech/web
[IMP] color setting is now done using, 'web_widget_color' module;
[REM] old behaviour with random colour; [ADD] Migration script between v 0.4 and v 1.0;7.0
parent
e8188d80d6
commit
c83923b31a
|
@ -22,8 +22,13 @@
|
||||||
##############################################################################
|
##############################################################################
|
||||||
{
|
{
|
||||||
"name": "Dashboard Tile",
|
"name": "Dashboard Tile",
|
||||||
"version": "0.4",
|
"version": "1.0",
|
||||||
"depends": ['web', 'board', 'mail'],
|
"depends": [
|
||||||
|
'web',
|
||||||
|
'board',
|
||||||
|
'mail',
|
||||||
|
'web_widget_color',
|
||||||
|
],
|
||||||
'author': "initOS GmbH & Co. KG,GRAP,Odoo Community Association (OCA)",
|
'author': "initOS GmbH & Co. KG,GRAP,Odoo Community Association (OCA)",
|
||||||
"category": "",
|
"category": "",
|
||||||
'license': 'AGPL-3',
|
'license': 'AGPL-3',
|
||||||
|
|
|
@ -25,11 +25,9 @@
|
||||||
model_id: base.model_ir_module_module
|
model_id: base.model_ir_module_module
|
||||||
domain: [['state', 'in', ['installed', 'to upgrade', 'to remove']]]
|
domain: [['state', 'in', ['installed', 'to upgrade', 'to remove']]]
|
||||||
action_id: base.open_module_tree
|
action_id: base.open_module_tree
|
||||||
color: 1
|
|
||||||
|
|
||||||
- !record {model: tile.tile, id: installed_OCA_modules}:
|
- !record {model: tile.tile, id: installed_OCA_modules}:
|
||||||
name: Installed OCA Modules
|
name: Installed OCA Modules
|
||||||
model_id: base.model_ir_module_module
|
model_id: base.model_ir_module_module
|
||||||
domain: [['state', 'in', ['installed', 'to upgrade', 'to remove']], ['author', 'ilike', 'Odoo Community Association (OCA)']]
|
domain: [['state', 'in', ['installed', 'to upgrade', 'to remove']], ['author', 'ilike', 'Odoo Community Association (OCA)']]
|
||||||
action_id: base.open_module_tree
|
action_id: base.open_module_tree
|
||||||
color: 2
|
|
||||||
|
|
|
@ -0,0 +1,48 @@
|
||||||
|
# -*- 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/>.
|
||||||
|
#
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
|
||||||
|
COLOR_NUMERIC_TO_RVB = {
|
||||||
|
0: '#006015',
|
||||||
|
1: '#CD2513',
|
||||||
|
2: '#CDC713',
|
||||||
|
3: '#57158A',
|
||||||
|
4: '#0E9B2D',
|
||||||
|
5: '#7F0C00',
|
||||||
|
6: '#7F7B00',
|
||||||
|
7: '#320455',
|
||||||
|
8: '#CD6E13',
|
||||||
|
9: '#0E6C7E',
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def migrate_color(cr):
|
||||||
|
for old, new in COLOR_NUMERIC_TO_RVB.iteritems():
|
||||||
|
cr.execute("""
|
||||||
|
UPDATE tile_tile
|
||||||
|
SET color='%s', font_color='#FFFFFF'
|
||||||
|
WHERE color='%s'
|
||||||
|
""" % (new, old))
|
||||||
|
|
||||||
|
|
||||||
|
def migrate(cr, installed_version):
|
||||||
|
migrate_color(cr)
|
|
@ -1,7 +1,7 @@
|
||||||
.openerp .oe_kanban_view .oe_dashbaord_tile{
|
.openerp .oe_kanban_view .oe_dashbaord_tile{
|
||||||
width: 150px;
|
width: 150px;
|
||||||
height: 150px;
|
height: 150px;
|
||||||
border: 0;
|
border: 1px solid;
|
||||||
border-radius: 0;
|
border-radius: 0;
|
||||||
}
|
}
|
||||||
.openerp .oe_kanban_view .oe_dashbaord_tile .tile_count{
|
.openerp .oe_kanban_view .oe_dashbaord_tile .tile_count{
|
||||||
|
@ -15,61 +15,3 @@
|
||||||
padding: 9px;
|
padding: 9px;
|
||||||
font-size: 15px;
|
font-size: 15px;
|
||||||
}
|
}
|
||||||
.openerp .oe_kanban_view .oe_dashbaord_tile a{
|
|
||||||
color: #fff;
|
|
||||||
}
|
|
||||||
.openerp .oe_kanban_view .oe_dashbaord_tile.oe_tile_color_,
|
|
||||||
.openerp .oe_kanban_view .oe_dashbaord_tile.oe_tile_color_ a,
|
|
||||||
.openerp .oe_kanban_view .oe_dashbaord_tile .oe_dropdown_menu a{
|
|
||||||
color: #000;
|
|
||||||
}
|
|
||||||
.openerp .oe_kanban_view .oe_tile_color_1,
|
|
||||||
.openerp .oe_dashbaord_tile a.oe_kanban_color_1{
|
|
||||||
background: #CD2513;
|
|
||||||
color: #fff;
|
|
||||||
}
|
|
||||||
.openerp .oe_kanban_view .oe_tile_color_2,
|
|
||||||
.openerp .oe_dashbaord_tile a.oe_kanban_color_2{
|
|
||||||
background: #CDC713;
|
|
||||||
color: #fff;
|
|
||||||
}
|
|
||||||
.openerp .oe_kanban_view .oe_tile_color_3,
|
|
||||||
.openerp .oe_dashbaord_tile a.oe_kanban_color_3{
|
|
||||||
background: #57158A;
|
|
||||||
color: #fff;
|
|
||||||
}
|
|
||||||
.openerp .oe_kanban_view .oe_tile_color_4,
|
|
||||||
.openerp .oe_dashbaord_tile a.oe_kanban_color_4{
|
|
||||||
background: #0E9B2D;
|
|
||||||
color: #fff;
|
|
||||||
}
|
|
||||||
.openerp .oe_kanban_view .oe_tile_color_5,
|
|
||||||
.openerp .oe_dashbaord_tile a.oe_kanban_color_5{
|
|
||||||
background: #7F0C00;
|
|
||||||
color: #fff;
|
|
||||||
}
|
|
||||||
.openerp .oe_kanban_view .oe_tile_color_6,
|
|
||||||
.openerp .oe_dashbaord_tile a.oe_kanban_color_6{
|
|
||||||
background: #7F7B00;
|
|
||||||
color: #fff;
|
|
||||||
}
|
|
||||||
.openerp .oe_kanban_view .oe_tile_color_7,
|
|
||||||
.openerp .oe_dashbaord_tile a.oe_kanban_color_7{
|
|
||||||
background: #320455;
|
|
||||||
color: #fff;
|
|
||||||
}
|
|
||||||
.openerp .oe_kanban_view .oe_tile_color_8,
|
|
||||||
.openerp .oe_dashbaord_tile a.oe_kanban_color_8{
|
|
||||||
background: #CD6E13;
|
|
||||||
color: #fff;
|
|
||||||
}
|
|
||||||
.openerp .oe_kanban_view .oe_tile_color_9,
|
|
||||||
.openerp .oe_dashbaord_tile a.oe_kanban_color_9{
|
|
||||||
background: #0E6C7E;
|
|
||||||
color: #fff;
|
|
||||||
}
|
|
||||||
.openerp .oe_kanban_view .oe_tile_color_0,
|
|
||||||
.openerp .oe_dashbaord_tile a.oe_kanban_color_0{
|
|
||||||
background: #006015;
|
|
||||||
color: #fff;
|
|
||||||
}
|
|
|
@ -74,14 +74,16 @@ class tile(orm.Model):
|
||||||
'active': fields.function(
|
'active': fields.function(
|
||||||
_get_tile_info, type='boolean', string='Active',
|
_get_tile_info, type='boolean', string='Active',
|
||||||
multi='tile_info', readonly=True, fnct_search=_search_active),
|
multi='tile_info', readonly=True, fnct_search=_search_active),
|
||||||
'color': fields.char('Kanban Color'),
|
'color': fields.char('Background color'),
|
||||||
|
'font_color': fields.char('Font Color'),
|
||||||
'sequence': fields.integer(
|
'sequence': fields.integer(
|
||||||
'Sequence', required=True),
|
'Sequence', required=True),
|
||||||
}
|
}
|
||||||
|
|
||||||
_defaults = {
|
_defaults = {
|
||||||
'domain': '[]',
|
'domain': '[]',
|
||||||
'color': 0,
|
'color': '#0E6C7E',
|
||||||
|
'font_color': '#FFFFFF',
|
||||||
'sequence': 0,
|
'sequence': 0,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,8 @@
|
||||||
<field name="model_id"/>
|
<field name="model_id"/>
|
||||||
<field name="user_id"/>
|
<field name="user_id"/>
|
||||||
<field name="action_id"/>
|
<field name="action_id"/>
|
||||||
|
<field name="color" widget="color"/>
|
||||||
|
<field name="font_color" widget="color"/>
|
||||||
</group>
|
</group>
|
||||||
</form>
|
</form>
|
||||||
</field>
|
</field>
|
||||||
|
@ -44,11 +46,11 @@
|
||||||
<field name="action_id"/>
|
<field name="action_id"/>
|
||||||
<field name="count"/>
|
<field name="count"/>
|
||||||
<field name="color"/>
|
<field name="color"/>
|
||||||
|
<field name="font_color"/>
|
||||||
<templates>
|
<templates>
|
||||||
<t t-name="kanban-box">
|
<t t-name="kanban-box">
|
||||||
<div t-attf-class="oe_tile_color_#{kanban_getcolor(record.color.raw_value)} oe_dashbaord_tile oe_kanban_global_click" >
|
<div t-attf-class="oe_dashbaord_tile oe_kanban_global_click" t-attf-style="background-color:#{record.color.raw_value}" >
|
||||||
<!-- FIXME: icon is hidden and edit not working if you have no form view
|
<!-- FIXME: icon is hidden and edit not working if you have no form view need more JS in the future -->
|
||||||
need more JS in the future -->
|
|
||||||
<div class="oe_dropdown_toggle oe_dropdown_kanban">
|
<div class="oe_dropdown_toggle oe_dropdown_kanban">
|
||||||
<span class="oe_e">í</span>
|
<span class="oe_e">í</span>
|
||||||
<ul class="oe_dropdown_menu">
|
<ul class="oe_dropdown_menu">
|
||||||
|
@ -58,7 +60,7 @@
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="oe_kanban_content">
|
<div class="oe_kanban_content">
|
||||||
<a type="object" name="open_link" args="[]">
|
<a type="object" name="open_link" args="[]" t-attf-style="color:#{record.font_color.raw_value};">
|
||||||
<div class="tile_label">
|
<div class="tile_label">
|
||||||
<b><field name="name"/></b>
|
<b><field name="name"/></b>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue