Browse Source

[ADD] mgmtsystem_kpi

pull/510/head^2
Maxime Chambreuil 13 years ago
commit
dddea1b776
  1. 22
      mgmtsystem_kpi/__init__.py
  2. 43
      mgmtsystem_kpi/__openerp__.py
  3. 98
      mgmtsystem_kpi/mgmtsystem_kpi.py
  4. 174
      mgmtsystem_kpi/mgmtsystem_kpi.xml

22
mgmtsystem_kpi/__init__.py

@ -0,0 +1,22 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2012 Savoir-faire Linux (<http://www.savoirfairelinux.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import mgmtsystem_kpi
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

43
mgmtsystem_kpi/__openerp__.py

@ -0,0 +1,43 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2012 Savoir-faire Linux (<http://www.savoirfairelinux.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
{
"name" : "Key Performance Indicator",
"version" : "0.1",
"author" : "Savoir-faire Linux",
"website" : "http://www.savoirfairelinux.com",
"license" : "GPL-3",
"category" : "Management System",
"complexity" : "normal",
"description": """
This module provides the basis for creating key performance indicators,
including static and dynamic thresholds.
""",
"depends" : ['mgmtsystem'],
"init_xml" : [],
"update_xml" : [
'mgmtsystem_kpi.xml',
],
"demo_xml" : [],
"installable" : True,
"certificate" : ''
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

98
mgmtsystem_kpi/mgmtsystem_kpi.py

@ -0,0 +1,98 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2012 Savoir-faire Linux (<http://www.savoirfairelinux.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from osv import fields, osv
class mgmtsystem_kpi_category(osv.osv):
"""
KPI Category
"""
_name = "mgmtsystem.kpi.category"
_description = "KPI Category"
_columns = {
'name': fields.char('Name', size=50, required=True),
'description': fields.text('Description')
}
mgmtsystem_kpi_category()
class mgmtsystem_kpi_threshold_range(osv.osv):
"""
KPI Threshold Range
"""
_name = "mgmtsystem.kpi.threshold.range"
_description = "KPI Threshold Range"
_columns = {
'name': fields.char('Name', size=50, required=True),
'min': fields.float('Minimum', required=True),
'max': fields.float('Maximum', size=50, required=True),
'color': fields.char('Color (RGB code)', size=7, required=True),
}
mgmtsystem_kpi_threshold_range()
class mgmtsystem_kpi_threshold(osv.osv):
"""
KPI Threshold
"""
_name = "mgmtsystem.kpi.threshold"
_description = "KPI Threshold"
_columns = {
'name': fields.char('Name', size=50, required=True),
'range_ids': fields.many2many('mgmtsystem.kpi.threshold.range','mgmtsystem_kpi_threshold_range_rel', 'threshold_id', 'range_id', 'Range', required=True),
}
mgmtsystem_kpi_threshold()
class mgmtsystem_kpi_periodicity_uom(osv.osv):
"""
Unit of Measure for Periodicity
"""
_name = "mgmtsystem.kpi.periodicity.uom"
_description = "Periodicity Unit of Measure"
_columns = {
'name': fields.char('Name', size=10, required=True),
}
mgmtsystem_kpi_threshold()
class mgmtsystem_kpi(osv.osv):
"""
Key Performance Indicators
"""
_name = "mgmtsystem.kpi"
_description = "Key Performance Indicator"
_columns = {
'name': fields.char('Name', size=50, required=True),
'description': fields.text('Description'),
'category_id': fields.many2one('mgmtsystem.kpi.category','Category', required=True),
'threshold_id': fields.many2one('mgmtsystem.kpi.threshold','Threshold', required=True),
'periodicity': fields.integer('Periodicity'),
'periodicity_uom': fields.many2one('mgmtsystem.kpi.periodicity.uom','Periodicity UoM', required=True),
'value': fields.float('Value'),
}
mgmtsystem_kpi()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

174
mgmtsystem_kpi/mgmtsystem_kpi.xml

@ -0,0 +1,174 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<!-- KPI -->
<record id="view_mgmtsystem_kpi_tree" model="ir.ui.view">
<field name="name">mgmtsystem.kpi.tree</field>
<field name="model">mgmtsystem.kpi</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Key Performance Indicators">
<field name="name"/>
<field name="category_id"/>
<field name="threshold_id"/>
<field name="value"/>
</tree>
</field>
</record>
<record id="view_mgmtsystem_kpi_form" model="ir.ui.view">
<field name="name">mgmtsystem.kpi.form</field>
<field name="model">mgmtsystem.kpi</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Key Performance Indicator">
<field name="name"/>
<field name="category_id"/>
<newline/>
<field name="value"/>
<field name="threshold_id"/>
<newline/>
<field name="periodicity"/>
<field name="periodicity_uom"/>
<newline/>
<field name="description" colspan="2"/>
</form>
</field>
</record>
<menuitem id="menu_mgmtsystem_kpi"
name="KPI"
action="open_mgmtsystem_kpi_list"
sequence="15"
parent="mgmtsystem.menu_mgmtsystem_main"
groups="base.group_user"/>
<record model="ir.actions.act_window" id="open_mgmtsystem_kpi_list">
<field name="name">Key Performance Indicators</field>
<field name="res_model">mgmtsystem.kpi</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="view_mgmtsystem_kpi_tree"/>
</record>
<!-- Thresholds -->
<record id="view_mgmtsystem_kpi_threshold_tree" model="ir.ui.view">
<field name="name">mgmtsystem.kpi.threshold.tree</field>
<field name="model">mgmtsystem.kpi.threshold</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Thresholds">
<field name="name"/>
</tree>
</field>
</record>
<record id="view_mgmtsystem_kpi_threshold_form" model="ir.ui.view">
<field name="name">mgmtsystem.kpi.threshold.form</field>
<field name="model">mgmtsystem.kpi.threshold</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Threshold">
<field name="name"/>
<newline/>
<field name="range_ids" nolabel="1" colspan="2">
<tree string="Ranges">
<field name="min"/>
<field name="max"/>
</tree>
</field>
</form>
</field>
</record>
<menuitem id="menu_mgmtsystem_configuration_kpi"
name="KPI"
parent="mgmtsystem.menu_mgmtsystem_configuration"
groups="base.group_mgmtsystem_manager"
sequence="20"/>
<menuitem id="menu_mgmtsystem_configuration_kpi_threshold"
name="Thresholds"
action="open_mgmtsystem_threshold_list"
parent="menu_mgmtsystem_configuration_kpi"
groups="base.group_mgmtsystem_manager"
sequence="10"/>
<record model="ir.actions.act_window" id="open_mgmtsystem_threshold_list">
<field name="name">Thresholds</field>
<field name="res_model">mgmtsystem.kpi.threshold</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="view_mgmtsystem_kpi_threshold_tree"/>
</record>
<!-- Ranges -->
<record id="view_mgmtsystem_kpi_threshold_range_tree" model="ir.ui.view">
<field name="name">mgmtsystem.kpi.threshold.range.tree</field>
<field name="model">mgmtsystem.kpi.threshold.range</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Ranges">
<field name="name"/>
<field name="min"/>
<field name="max"/>
<field name="color"/>
</tree>
</field>
</record>
<record id="view_mgmtsystem_kpi_threshold_range_form" model="ir.ui.view">
<field name="name">mgmtsystem.kpi.threshold.range.form</field>
<field name="model">mgmtsystem.kpi.threshold.range</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Range">
<field name="name"/>
<newline/>
<field name="min"/>
<field name="max"/>
<newline/>
<field name="color"/>
</form>
</field>
</record>
<menuitem id="menu_mgmtsystem_configuration_kpi_range"
name="Ranges"
action="open_mgmtsystem_threshold_range_list"
parent="menu_mgmtsystem_configuration_kpi"
groups="base.group_mgmtsystem_manager"
sequence="20"/>
<record model="ir.actions.act_window" id="open_mgmtsystem_threshold_range_list">
<field name="name">Ranges</field>
<field name="res_model">mgmtsystem.kpi.threshold.range</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="view_mgmtsystem_kpi_threshold_range_tree"/>
</record>
<!-- data -->
<record model="mgmtsystem.kpi.periodicity.uom" id="hour">
<field name="name">Hour</field>
</record>
<record model="mgmtsystem.kpi.periodicity.uom" id="day">
<field name="name">Day</field>
</record>
<record model="mgmtsystem.kpi.periodicity.uom" id="week">
<field name="name">Week</field>
</record>
<record model="mgmtsystem.kpi.periodicity.uom" id="month">
<field name="name">Month</field>
</record>
</data>
</openerp>
Loading…
Cancel
Save