Browse Source

[REVERT] tile move create PR hard to review;

pull/111/head
Sylvain LE GAL 10 years ago
parent
commit
30fbca6a3d
  1. 2
      web_dashboard_tile/__init__.py
  2. 26
      web_dashboard_tile/model/__init__.py
  3. 12
      web_dashboard_tile/tile.py

2
web_dashboard_tile/__init__.py

@ -23,4 +23,4 @@
#
##############################################################################
from . import model
from . import tile

26
web_dashboard_tile/model/__init__.py

@ -1,26 +0,0 @@
# -*- 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/>.
#
##############################################################################
from . import tile

12
web_dashboard_tile/model/tile.py → web_dashboard_tile/tile.py

@ -62,16 +62,16 @@ class tile(orm.Model):
desc = r.field_id.field_description
if r.field_function == 'min':
value = min(vals)
helper = _("'Minimum value of %s'" % desc)
helper = _("Minimum value of '%s'" % desc)
elif r.field_function == 'max':
value = max(vals)
helper = _("'Maximum value of %s'" % desc)
helper = _("Maximum value of '%s'" % desc)
elif r.field_function == 'sum':
value = sum(vals)
helper = _("'Total value of %s'" % desc)
helper = _("Total value of '%s'" % desc)
elif r.field_function == 'avg':
value = sum(vals) / len(vals)
helper = _("'Average value of %s'" % desc)
helper = _("Average value of '%s'" % desc)
res[r.id].update({
'computed_value': value,
'helper': helper,
@ -105,7 +105,7 @@ class tile(orm.Model):
_get_tile_info, type='float', string='Computed Value',
multi='tile_info', readonly=True),
'helper': fields.function(
_get_tile_info, type='char', string='Helper',
_get_tile_info, type='char', string='Helper Text',
multi='tile_info', readonly=True),
'field_function': fields.selection([
('min', 'Minimum'),
@ -142,7 +142,7 @@ class tile(orm.Model):
_constraints = [
(
_check_model_id_field_id,
"Error ! Please select a field of the select model.",
"Error ! Please select a field of the selected model.",
['model_id', 'field_id']),
(
_check_field_id_field_function,
Loading…
Cancel
Save