Browse Source

[MIG] kpi to v11

pull/267/head
Adrià Gil Sorribes 6 years ago
parent
commit
09bc90889f
  1. 1
      kpi/__init__.py
  2. 3
      kpi/__manifest__.py
  3. 12
      kpi/data/kpi.xml
  4. 1
      kpi/models/__init__.py
  5. 7
      kpi/models/kpi.py
  6. 3
      kpi/models/kpi_category.py
  7. 3
      kpi/models/kpi_history.py
  8. 3
      kpi/models/kpi_threshold.py
  9. 5
      kpi/models/kpi_threshold_range.py
  10. 1
      kpi/tests/__init__.py
  11. 3
      kpi/tests/test_kpi.py
  12. 27
      kpi/views/kpi.xml
  13. 6
      kpi/views/kpi_category.xml
  14. 2
      kpi/views/kpi_history.xml
  15. 4
      kpi/views/kpi_threshold.xml
  16. 39
      kpi/views/kpi_threshold_range.xml
  17. 2
      kpi/views/menu.xml

1
kpi/__init__.py

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright 2012 - Now Savoir-faire Linux <https://www.savoirfairelinux.com/>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

3
kpi/__openerp__.py → kpi/__manifest__.py

@ -1,10 +1,9 @@
# -*- coding: utf-8 -*-
# Copyright 2012 - Now Savoir-faire Linux <https://www.savoirfairelinux.com/>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "Key Performance Indicator",
"version": "9.0.1.1.0",
"version": "11.0.1.1.0",
"author": "Savoir-faire Linux,Odoo Community Association (OCA)",
"website": "http://www.savoirfairelinux.com",
"license": "AGPL-3",

12
kpi/data/kpi.xml

@ -1,18 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2012 - Now Savoir-faire Linux <https://www.savoirfairelinux.com/>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
<odoo>
<data noupdate="1">
<odoo noupdate="1">
<record forcecreate="True" id="ir_cron_kpi_action" model="ir.cron">
<field name="name">Update KPI values</field>
<field name="user_id" ref="base.user_root"/>
<field name="interval_number">1</field>
<field name="interval_type">hours</field>
<field name="numbercall">-1</field>
<field eval="False" name="doall"/>
<field eval="'kpi'" name="model"/>
<field eval="'update_kpi_value'" name="function"/>
<field eval="'()'" name="args"/>
<field name="doall" eval="False"/>
<field name="model_id" ref="model_kpi"/>
<field name="state">code</field>
<field name="code">model.update_kpi_value()</field>
</record>
</data>
</odoo>

1
kpi/models/__init__.py

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright 2012 - Now Savoir-faire Linux <https://www.savoirfairelinux.com/>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

7
kpi/models/kpi.py

@ -1,11 +1,10 @@
# -*- coding: utf-8 -*-
# Copyright 2012 - Now Savoir-faire Linux <https://www.savoirfairelinux.com/>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from datetime import datetime, timedelta
from openerp import fields, models, api
from openerp.tools.safe_eval import safe_eval
from openerp.tools import (
from odoo import fields, models, api
from odoo.tools.safe_eval import safe_eval
from odoo.tools import (
DEFAULT_SERVER_DATETIME_FORMAT as DATETIME_FORMAT,
)
import re

3
kpi/models/kpi_category.py

@ -1,8 +1,7 @@
# -*- coding: utf-8 -*-
# Copyright 2012 - Now Savoir-faire Linux <https://www.savoirfairelinux.com/>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from openerp import fields, models
from odoo import fields, models
class KPICategory(models.Model):

3
kpi/models/kpi_history.py

@ -1,8 +1,7 @@
# -*- coding: utf-8 -*-
# Copyright 2012 - Now Savoir-faire Linux <https://www.savoirfairelinux.com/>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from openerp import fields, models
from odoo import fields, models
class KPIHistory(models.Model):

3
kpi/models/kpi_threshold.py

@ -1,8 +1,7 @@
# -*- coding: utf-8 -*-
# Copyright 2012 - Now Savoir-faire Linux <https://www.savoirfairelinux.com/>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from openerp import fields, models, api, exceptions, _
from odoo import fields, models, api, exceptions, _
class KPIThreshold(models.Model):

5
kpi/models/kpi_threshold_range.py

@ -1,9 +1,8 @@
# -*- coding: utf-8 -*-
# Copyright 2012 - Now Savoir-faire Linux <https://www.savoirfairelinux.com/>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from openerp import fields, models, api
from openerp.tools.safe_eval import safe_eval
from odoo import fields, models, api
from odoo.tools.safe_eval import safe_eval
import re

1
kpi/tests/__init__.py

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from . import test_kpi

3
kpi/tests/test_kpi.py

@ -1,7 +1,6 @@
# -*- coding: utf-8 -*-
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from openerp.tests.common import TransactionCase
from odoo.tests.common import TransactionCase
class TestKPI(TransactionCase):

27
kpi/views/kpi.xml

@ -2,7 +2,6 @@
<!-- Copyright 2012 - Now Savoir-faire Linux <https://www.savoirfairelinux.com/>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
<odoo>
<data>
<!-- KPI -->
<record id="view_kpi_tree" model="ir.ui.view">
<field name="name">kpi.tree</field>
@ -35,7 +34,7 @@
<field name="company_id" group="base.group_multi_company"/>
</group>
<newline/>
<group expand="0" string="Group By...">
<group expand="0" name="Group By...">
<filter string="Category" context="{'group_by':'category_id'}"/>
<filter string="Type" context="{'group_by':'kpi_type'}"/>
</group>
@ -49,15 +48,18 @@
<field name="arch" type="xml">
<form string="Key Performance Indicator">
<sheet>
<group col="6" colspan="6">
<field name="name" colspan="2"/>
<field name="threshold_id" colspan="2"/>
<field name="category_id" colspan="2"/>
<newline/>
<group>
<group>
<field name="name" />
<field name="threshold_id" />
<field name="category_id" />
</group>
<group>
<field name="value" colspan="2"/>
<button name="compute_kpi_value" string="Compute KPI Now" colspan="2" type="object"/>
<field name="active" colspan="2"/>
<field name="company_id" groups="base.group_multi_company"/>
<button name="compute_kpi_value" string="Compute KPI Now" colspan="2" type="object"/>
</group>
</group>
<notebook colspan="6">
<page string="History">
@ -65,9 +67,9 @@
</page>
<page string="Computation">
<group col="6">
<field name="periodicity" colspan="2"/>
<field name="periodicity_uom" colspan="2"/>
<field name="next_execution_date" colspan="2"/>
<field name="periodicity" colspan="3"/>
<field name="periodicity_uom" colspan="3"/>
<field name="next_execution_date" colspan="3"/>
<separator string="KPI Computation" colspan="6"/>
<newline/>
<field name="kpi_type" colspan="2"/>
@ -93,7 +95,4 @@
<field name="view_id" ref="view_kpi_tree"/>
<field name="search_view_id" ref="view_kpi_filter"/>
</record>
</data>
</odoo>

6
kpi/views/kpi_category.xml

@ -3,9 +3,6 @@
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
<odoo>
<data>
<!-- Categories -->
<record id="view_kpi_category_tree" model="ir.ui.view">
@ -41,7 +38,4 @@
<field name="view_mode">tree,form</field>
<field name="view_id" ref="view_kpi_category_tree"/>
</record>
</data>
</odoo>

2
kpi/views/kpi_history.xml

@ -3,7 +3,6 @@
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
<odoo>
<data>
<!-- KPI history -->
<record id="view_kpi_history_tree" model="ir.ui.view">
<field name="name">kpi.history.tree</field>
@ -36,5 +35,4 @@
</form>
</field>
</record>
</data>
</odoo>

4
kpi/views/kpi_threshold.xml

@ -3,7 +3,6 @@
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
<odoo>
<data>
<!-- Thresholds -->
<record id="view_kpi_threshold_tree" model="ir.ui.view">
<field name="name">kpi.threshold.tree</field>
@ -51,7 +50,4 @@
<field name="view_mode">tree,form</field>
<field name="view_id" ref="view_kpi_threshold_tree"/>
</record>
</data>
</odoo>

39
kpi/views/kpi_threshold_range.xml

@ -3,7 +3,6 @@
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
<odoo>
<data>
<!-- Ranges -->
<record id="view_kpi_threshold_range_tree" model="ir.ui.view">
<field name="name">kpi.threshold.range.tree</field>
@ -27,31 +26,31 @@
<form string="Range">
<sheet>
<group col="6" colspan="6">
<field name="name"/>
<field name="color"/>
<field name="company_id" groups="base.group_multi_company"/>
<newline/>
<separator string="Minimum" colspan="4"/>
<newline/>
<field name="min_type" colspan="2"/>
<field name="min_fixed_value" colspan="2" attrs="{'invisible' : [('min_type', '!=', 'static')]}"/>
<field name="min_dbsource_id" colspan="2" attrs="{'invisible' : [('min_type', '!=', 'external')]}"/>
<newline/>
<field name="min_code" colspan="6" attrs="{'invisible' : [('min_type', 'NOT IN', ('local','external','python'))]}"/>
<field name="name" colspan="2"/>
<field name="color" colspan="2"/>
<field name="company_id" groups="base.group_multi_company" colspan="2" />
</group>
<group col="6">
<separator string="Minimum"/>
<newline/>
<field name="min_type" colspan="3"/>
<field name="min_fixed_value" colspan="3" attrs="{'invisible' : [('min_type', '!=', 'static')]}"/>
<field name="min_dbsource_id" colspan="3" attrs="{'invisible' : [('min_type', '!=', 'external')]}"/>
<field name="min_code" colspan="6" attrs="{'invisible' : [('min_type', 'not in', ('local','external','python'))]}"/>
<field name="min_error" colspan="6" attrs="{'invisible': [('min_error', '=', False)]}" />
<newline/>
<separator string="Maximum" colspan="4"/>
<separator string="Maximum"/>
<newline/>
<field name="max_type"/>
<field name="max_fixed_value" attrs="{'invisible' : [('max_type', '!=', 'static')]}"/>
<field name="max_dbsource_id" attrs="{'invisible' : [('max_type', '!=', 'external')]}"/>
<field name="max_type" colspan="3"/>
<field name="max_fixed_value" colspan="3" attrs="{'invisible' : [('max_type', '!=', 'static')]}"/>
<field name="max_dbsource_id" colspan="3" attrs="{'invisible' : [('max_type', '!=', 'external')]}"/>
<newline/>
<field name="max_code" colspan="6" attrs="{'invisible' : [('max_type', 'NOT IN', ('local','external','python'))]}"/>
<field name="max_code" colspan="6" attrs="{'invisible' : [('max_type', 'not in', ('local','external','python'))]}"/>
<newline/>
<field name="max_error" colspan="6" attrs="{'invisible': [('max_error', '=', False)]}" />
<newline/>
</group>
<group col="6" colspan="6">
<separator string="Thresholds" colspan="4"/>
<field name="threshold_ids" nolabel="1" colspan="4"/>
<separator string="Errors" attrs="{'invisible' : [('invalid_message', '=', False)]}" colspan="4"/>
@ -69,8 +68,4 @@
<field name="view_mode">tree,form</field>
<field name="view_id" ref="view_kpi_threshold_range_tree"/>
</record>
</data>
</odoo>

2
kpi/views/menu.xml

@ -3,7 +3,6 @@
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
<odoo>
<data>
<menuitem id="menu_reporting_kpi"
name="KPI"
action="open_kpi_list"
@ -44,5 +43,4 @@
parent="menu_configuration_kpi"
groups="base.group_user"
sequence="10"/>
</data>
</odoo>
Loading…
Cancel
Save