Browse Source

[IMP] Views. Computation code left to do.

pull/510/head^2
Maxime Chambreuil 13 years ago
parent
commit
61161911db
  1. 31
      mgmtsystem_kpi/mgmtsystem_kpi.py
  2. 71
      mgmtsystem_kpi/mgmtsystem_kpi.xml

31
mgmtsystem_kpi/mgmtsystem_kpi.py

@ -41,11 +41,27 @@ class mgmtsystem_kpi_threshold_range(osv.osv):
_name = "mgmtsystem.kpi.threshold.range" _name = "mgmtsystem.kpi.threshold.range"
_description = "KPI Threshold Range" _description = "KPI Threshold Range"
def _compute_min_value(self, cr, uid, ids, field_name, arg, context=None):
result = {}
return result
def _compute_max_value(self, cr, uid, ids, field_name, arg, context=None):
result = {}
return result
_columns = { _columns = {
'name': fields.char('Name', size=50, required=True), '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),
'min_type': fields.selection((('static','Fixed value'), ('dynamic','Computed value')), 'Min Type', required=True),
'min_value': fields.function(_compute_min_value, string='Minimum', type='float'),
'min_fixed_value': fields.float('Minimum'),
'min_code': fields.text('Minimum Computation Code'),
'max_type': fields.selection((('static','Fixed value'), ('dynamic','Computed value')), 'Max Type', required=True),
'max_value': fields.function(_compute_max_value, string='Maximum', type='float'),
'max_fixed_value': fields.float('Maximum'),
'max_code': fields.text('Maximum Computation Code'),
'color': fields.char('Color', help='RGB code with #', size=7, required=True),
} }
mgmtsystem_kpi_threshold_range() mgmtsystem_kpi_threshold_range()
@ -83,6 +99,12 @@ class mgmtsystem_kpi(osv.osv):
""" """
_name = "mgmtsystem.kpi" _name = "mgmtsystem.kpi"
_description = "Key Performance Indicator" _description = "Key Performance Indicator"
def _compute_kpi_value(self, cr, uid, ids, field_name, arg, context=None):
result= {}
return result
_columns = { _columns = {
'name': fields.char('Name', size=50, required=True), 'name': fields.char('Name', size=50, required=True),
'description': fields.text('Description'), 'description': fields.text('Description'),
@ -90,7 +112,8 @@ class mgmtsystem_kpi(osv.osv):
'threshold_id': fields.many2one('mgmtsystem.kpi.threshold','Threshold', required=True), 'threshold_id': fields.many2one('mgmtsystem.kpi.threshold','Threshold', required=True),
'periodicity': fields.integer('Periodicity'), 'periodicity': fields.integer('Periodicity'),
'periodicity_uom': fields.many2one('mgmtsystem.kpi.periodicity.uom','Periodicity UoM', required=True), 'periodicity_uom': fields.many2one('mgmtsystem.kpi.periodicity.uom','Periodicity UoM', required=True),
'value': fields.float('Value'),
'value': fields.function(_compute_kpi_value, string='Value', type='float'),
'kpi_code': fields.text('KPI Computation Code'),
} }
mgmtsystem_kpi() mgmtsystem_kpi()

71
mgmtsystem_kpi/mgmtsystem_kpi.xml

@ -33,18 +33,13 @@
<field name="periodicity"/> <field name="periodicity"/>
<field name="periodicity_uom"/> <field name="periodicity_uom"/>
<newline/> <newline/>
<field name="description" colspan="2"/>
<field name="kpi_code" colspan="4"/>
<newline/>
<field name="description" colspan="4"/>
</form> </form>
</field> </field>
</record> </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"> <record model="ir.actions.act_window" id="open_mgmtsystem_kpi_list">
<field name="name">Key Performance Indicators</field> <field name="name">Key Performance Indicators</field>
<field name="res_model">mgmtsystem.kpi</field> <field name="res_model">mgmtsystem.kpi</field>
@ -53,6 +48,13 @@
<field name="view_id" ref="view_mgmtsystem_kpi_tree"/> <field name="view_id" ref="view_mgmtsystem_kpi_tree"/>
</record> </record>
<menuitem id="menu_mgmtsystem_kpi"
name="KPI"
action="open_mgmtsystem_kpi_list"
sequence="15"
parent="mgmtsystem.menu_mgmtsystem_main"
groups="base.group_user"/>
<!-- Thresholds --> <!-- Thresholds -->
<record id="view_mgmtsystem_kpi_threshold_tree" model="ir.ui.view"> <record id="view_mgmtsystem_kpi_threshold_tree" model="ir.ui.view">
@ -76,8 +78,9 @@
<newline/> <newline/>
<field name="range_ids" nolabel="1" colspan="2"> <field name="range_ids" nolabel="1" colspan="2">
<tree string="Ranges"> <tree string="Ranges">
<field name="min"/>
<field name="max"/>
<field name="name"/>
<field name="min_value"/>
<field name="max_value"/>
</tree> </tree>
</field> </field>
</form> </form>
@ -90,13 +93,6 @@
groups="base.group_mgmtsystem_manager" groups="base.group_mgmtsystem_manager"
sequence="20"/> 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"> <record model="ir.actions.act_window" id="open_mgmtsystem_threshold_list">
<field name="name">Thresholds</field> <field name="name">Thresholds</field>
<field name="res_model">mgmtsystem.kpi.threshold</field> <field name="res_model">mgmtsystem.kpi.threshold</field>
@ -105,6 +101,13 @@
<field name="view_id" ref="view_mgmtsystem_kpi_threshold_tree"/> <field name="view_id" ref="view_mgmtsystem_kpi_threshold_tree"/>
</record> </record>
<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"/>
<!-- Ranges --> <!-- Ranges -->
<record id="view_mgmtsystem_kpi_threshold_range_tree" model="ir.ui.view"> <record id="view_mgmtsystem_kpi_threshold_range_tree" model="ir.ui.view">
@ -114,8 +117,8 @@
<field name="arch" type="xml"> <field name="arch" type="xml">
<tree string="Ranges"> <tree string="Ranges">
<field name="name"/> <field name="name"/>
<field name="min"/>
<field name="max"/>
<field name="min_value"/>
<field name="max_value"/>
<field name="color"/> <field name="color"/>
</tree> </tree>
</field> </field>
@ -128,22 +131,25 @@
<field name="arch" type="xml"> <field name="arch" type="xml">
<form string="Range"> <form string="Range">
<field name="name"/> <field name="name"/>
<field name="color"/>
<newline/> <newline/>
<field name="min"/>
<field name="max"/>
<separator string="Minimum" colspan="4"/>
<newline/> <newline/>
<field name="color"/>
<field name="min_type"/>
<field name="min_fixed_value" attrs="{'invisible' : [('min_type', '!=', 'static')]}"/>
<newline/>
<field name="min_code" colspan="4" attrs="{'invisible' : [('min_type', '!=', 'dynamic')]}"/>
<newline/>
<separator string="Maximum" colspan="4"/>
<newline/>
<field name="max_type"/>
<field name="max_fixed_value" attrs="{'invisible' : [('max_type', '!=', 'static')]}"/>
<newline/>
<field name="max_code" colspan="4" attrs="{'invisible' : [('max_type', '!=', 'dynamic')]}"/>
</form> </form>
</field> </field>
</record> </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"> <record model="ir.actions.act_window" id="open_mgmtsystem_threshold_range_list">
<field name="name">Ranges</field> <field name="name">Ranges</field>
<field name="res_model">mgmtsystem.kpi.threshold.range</field> <field name="res_model">mgmtsystem.kpi.threshold.range</field>
@ -152,6 +158,13 @@
<field name="view_id" ref="view_mgmtsystem_kpi_threshold_range_tree"/> <field name="view_id" ref="view_mgmtsystem_kpi_threshold_range_tree"/>
</record> </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"/>
<!-- data --> <!-- data -->
<record model="mgmtsystem.kpi.periodicity.uom" id="hour"> <record model="mgmtsystem.kpi.periodicity.uom" id="hour">

Loading…
Cancel
Save