[MIG] kpi to v11

This commit is contained in:
Adrià Gil Sorribes
2018-11-12 11:25:13 +01:00
committed by flachica
parent 95039c95fa
commit 36a7d9477f
25 changed files with 380 additions and 360 deletions

View File

@@ -1,10 +1,29 @@
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
=========================
Key Performance Indicator
=========================
===
KPI
===
.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-LGPL--3-blue.png
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
:alt: License: LGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fserver--tools-lightgray.png?logo=github
:target: https://github.com/OCA/server-tools/tree/11.0/kpi
:alt: OCA/server-tools
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/server-tools-11-0/server-tools-11-0-kpi
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/253/11.0
:alt: Try me on Runbot
|badge1| |badge2| |badge3| |badge4|
This module provides the basis for creating key performance indicators,
including static and dynamic thresholds (SQL query or Python code),
@@ -22,6 +41,12 @@ A threshold is a list of ranges and a range is:
* a maximum value (fixed, sql query or python code)
* color (RGB code like #00FF00 for green, #FFA500 for orange, #FF0000 for red)
**Table of contents**
.. contents::
:local:
Configuration
=============
@@ -32,11 +57,9 @@ Users must be added to the appropriate groups within Odoo as follows:
Usage
=====
Example of usage:
https://www.youtube.com/watch?v=OC4-y2klzIk
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/128/9.0
Known issues / Roadmap
======================
@@ -48,12 +71,16 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/OCA/server-tools/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
`feedback <https://github.com/OCA/server-tools/issues/new?body=module:%20kpi%0Aversion:%2011.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
Do not contact contributors directly about support or help with technical issues.
Credits
=======
Contributors
------------
~~~~~~~~~~~~
* Daniel Reis <dreis.pt@hotmail.com>
* Glen Dromgoole <gdromgoole@tier1engineering.com>
@@ -62,17 +89,19 @@ Contributors
* Gervais Naoussi <gervaisnaoussi@gmail.com>
* Iván Todorovich <ivan.todorovich@gmail.com>
Maintainer
----------
Maintainers
~~~~~~~~~~~
This module is maintained by the OCA.
.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org
This module is maintained by the OCA.
OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.
To contribute to this module, please visit https://odoo-community.org.
This module is part of the `OCA/server-tools <https://github.com/OCA/server-tools/tree/11.0/kpi>`_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

View File

@@ -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).

View File

@@ -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",

View File

@@ -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">
<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"/>
</record>
</data>
<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 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>
</odoo>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 41 KiB

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 46 KiB

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 31 KiB

View File

@@ -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).

View File

@@ -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

View File

@@ -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):

View File

@@ -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):

View File

@@ -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):

View File

@@ -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

View File

@@ -0,0 +1,6 @@
* Daniel Reis <dreis.pt@hotmail.com>
* Glen Dromgoole <gdromgoole@tier1engineering.com>
* Loic Lacroix <loic.lacroix@savoirfairelinux.com>
* Sandy Carter <sandy.carter@savoirfairelinux.com>
* Gervais Naoussi <gervaisnaoussi@gmail.com>
* Iván Todorovich <ivan.todorovich@gmail.com>

View File

@@ -0,0 +1,15 @@
This module provides the basis for creating key performance indicators,
including static and dynamic thresholds (SQL query or Python code),
on local and remote data sources.
The module also provides the mecanism to update KPIs automatically.
A scheduler is executed every hour and updates the KPI values, based
on the periodicity of each KPI. KPI computation can also be done
manually.
A threshold is a list of ranges and a range is:
* a name (like Good, Warning, Bad)
* a minimum value (fixed, sql query or python code)
* a maximum value (fixed, sql query or python code)
* color (RGB code like #00FF00 for green, #FFA500 for orange, #FF0000 for red)

2
kpi/readme/USAGE.rst Normal file
View File

@@ -0,0 +1,2 @@
Example of usage:
https://www.youtube.com/watch?v=OC4-y2klzIk

View File

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

View File

@@ -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):

View File

@@ -2,98 +2,97 @@
<!-- 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>
<field name="model">kpi</field>
<field name="arch" type="xml">
<tree string="Key Performance Indicators">
<!-- KPI -->
<record id="view_kpi_tree" model="ir.ui.view">
<field name="name">kpi.tree</field>
<field name="model">kpi</field>
<field name="arch" type="xml">
<tree string="Key Performance Indicators">
<field name="name"/>
<field name="value" widget="progressbar"/>
<field name="category_id"/>
<field name="kpi_type"/>
<field name="company_id" groups="base.group_multi_company"/>
</tree>
</field>
</record>
<record id="view_kpi_filter" model="ir.ui.view">
<field name="name">kpi.filter</field>
<field name="model">kpi</field>
<field name="arch" type="xml">
<search string="KPI">
<group>
<filter name="active"
icon="terp-document-new"
domain="[('active','=',True)]"
string="Active"
help="Only active KPIs are computed by the scheduler based on the periodicity configuration."/>
<separator orientation="vertical"/>
<field name="name"/>
<field name="value" widget="progressbar"/>
<field name="category_id"/>
<field name="kpi_type"/>
<field name="company_id" groups="base.group_multi_company"/>
</tree>
</field>
</record>
<field name="company_id" group="base.group_multi_company"/>
</group>
<newline/>
<group expand="0" name="Group By...">
<filter string="Category" context="{'group_by':'category_id'}"/>
<filter string="Type" context="{'group_by':'kpi_type'}"/>
</group>
</search>
</field>
</record>
<record id="view_kpi_filter" model="ir.ui.view">
<field name="name">kpi.filter</field>
<field name="model">kpi</field>
<field name="arch" type="xml">
<search string="KPI">
<record id="view_kpi_form" model="ir.ui.view">
<field name="name">kpi.form</field>
<field name="model">kpi</field>
<field name="arch" type="xml">
<form string="Key Performance Indicator">
<sheet>
<group>
<filter name="active"
icon="terp-document-new"
domain="[('active','=',True)]"
string="Active"
help="Only active KPIs are computed by the scheduler based on the periodicity configuration."/>
<separator orientation="vertical"/>
<field name="name"/>
<field name="category_id"/>
<field name="company_id" group="base.group_multi_company"/>
</group>
<newline/>
<group expand="0" string="Group By...">
<filter string="Category" context="{'group_by':'category_id'}"/>
<filter string="Type" context="{'group_by':'kpi_type'}"/>
</group>
</search>
</field>
</record>
<record id="view_kpi_form" model="ir.ui.view">
<field name="name">kpi.form</field>
<field name="model">kpi</field>
<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>
<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>
<notebook colspan="6">
<page string="History">
<field name="history_ids" readonly="1" nolabel="1"/>
</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"/>
<separator string="KPI Computation" colspan="6"/>
<newline/>
<field name="kpi_type" colspan="2"/>
<field name="dbsource_id" colspan="2" attrs="{'invisible' : [('kpi_type', '!=', 'external')]}"/>
<newline/>
<field name="kpi_code" colspan="6"/>
</group>
</page>
<page string="Description">
<field name="description" nolabel="1"/>
</page>
</notebook>
</sheet>
</form>
</field>
</record>
</group>
<notebook colspan="6">
<page string="History">
<field name="history_ids" readonly="1" nolabel="1"/>
</page>
<page string="Computation">
<group col="6">
<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"/>
<field name="dbsource_id" colspan="2" attrs="{'invisible' : [('kpi_type', '!=', 'external')]}"/>
<newline/>
<field name="kpi_code" colspan="6"/>
</group>
</page>
<page string="Description">
<field name="description" nolabel="1"/>
</page>
</notebook>
</sheet>
</form>
</field>
</record>
<record model="ir.actions.act_window" id="open_kpi_list">
<field name="name">Key Performance Indicators</field>
<field name="res_model">kpi</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="view_kpi_tree"/>
<field name="search_view_id" ref="view_kpi_filter"/>
</record>
</data>
<record model="ir.actions.act_window" id="open_kpi_list">
<field name="name">Key Performance Indicators</field>
<field name="res_model">kpi</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="view_kpi_tree"/>
<field name="search_view_id" ref="view_kpi_filter"/>
</record>
</odoo>

View File

@@ -3,45 +3,39 @@
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">
<field name="name">kpi.category.tree</field>
<field name="model">kpi.category</field>
<field name="arch" type="xml">
<tree string="Categories">
<field name="name"/>
</tree>
</field>
</record>
<!-- Categories -->
<record id="view_kpi_category_form" model="ir.ui.view">
<field name="name">kpi.category.form</field>
<field name="model">kpi.category</field>
<field name="arch" type="xml">
<form string="Category">
<sheet>
<group col="2" colspan="2">
<field name="name" colspan="2"/>
<newline/>
<field name="description" colspan="2"/>
</group>
</sheet>
</form>
</field>
</record>
<record id="view_kpi_category_tree" model="ir.ui.view">
<field name="name">kpi.category.tree</field>
<field name="model">kpi.category</field>
<field name="arch" type="xml">
<tree string="Categories">
<field name="name"/>
</tree>
</field>
</record>
<record id="view_kpi_category_form" model="ir.ui.view">
<field name="name">kpi.category.form</field>
<field name="model">kpi.category</field>
<field name="arch" type="xml">
<form string="Category">
<sheet>
<group col="2" colspan="2">
<field name="name" colspan="2"/>
<newline/>
<field name="description" colspan="2"/>
</group>
</sheet>
</form>
</field>
</record>
<record model="ir.actions.act_window" id="open_category_list">
<field name="name">Categories</field>
<field name="res_model">kpi.category</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="view_kpi_category_tree"/>
</record>
</data>
<record model="ir.actions.act_window" id="open_category_list">
<field name="name">Categories</field>
<field name="res_model">kpi.category</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="view_kpi_category_tree"/>
</record>
</odoo>

View File

@@ -3,38 +3,36 @@
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>
<field name="model">kpi.history</field>
<field name="arch" type="xml">
<tree string="KPI History">
<field name="name"/>
<field name="date"/>
<field name="value"/>
<field name="color" widget="color"/>
<field name="company_id" groups="base.group_multi_company"/>
</tree>
</field>
</record>
<record id="view_kpi_history_form" model="ir.ui.view">
<field name="name">kpi.history.form</field>
<field name="model">kpi.history</field>
<field name="arch" type="xml">
<form string="KPI History">
<sheet>
<group col="4" colspan="4">
<field name="kpi_id"/>
<field name="name"/>
<field name="date"/>
<field name="value"/>
<field name="color" widget="color"/>
<field name="company_id" groups="base.group_multi_company"/>
</group>
</sheet>
</form>
</field>
</record>
</data>
<!-- KPI history -->
<record id="view_kpi_history_tree" model="ir.ui.view">
<field name="name">kpi.history.tree</field>
<field name="model">kpi.history</field>
<field name="arch" type="xml">
<tree string="KPI History">
<field name="name"/>
<field name="date"/>
<field name="value"/>
<field name="color" widget="color"/>
<field name="company_id" groups="base.group_multi_company"/>
</tree>
</field>
</record>
<record id="view_kpi_history_form" model="ir.ui.view">
<field name="name">kpi.history.form</field>
<field name="model">kpi.history</field>
<field name="arch" type="xml">
<form string="KPI History">
<sheet>
<group col="4" colspan="4">
<field name="kpi_id"/>
<field name="name"/>
<field name="date"/>
<field name="value"/>
<field name="color" widget="color"/>
<field name="company_id" groups="base.group_multi_company"/>
</group>
</sheet>
</form>
</field>
</record>
</odoo>

View File

@@ -3,55 +3,51 @@
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>
<field name="model">kpi.threshold</field>
<field name="arch" type="xml">
<tree string="Thresholds" decoration-danger="invalid_message">
<field name="name"/>
<field name="invalid_message"/>
<field name="company_id" groups="base.group_multi_company"/>
</tree>
</field>
</record>
<!-- Thresholds -->
<record id="view_kpi_threshold_tree" model="ir.ui.view">
<field name="name">kpi.threshold.tree</field>
<field name="model">kpi.threshold</field>
<field name="arch" type="xml">
<tree string="Thresholds" decoration-danger="invalid_message">
<field name="name"/>
<field name="invalid_message"/>
<field name="company_id" groups="base.group_multi_company"/>
</tree>
</field>
</record>
<record id="view_kpi_threshold_form" model="ir.ui.view">
<field name="name">kpi.threshold.form</field>
<field name="model">kpi.threshold</field>
<field name="arch" type="xml">
<form string="Threshold">
<sheet>
<group col="6" colspan="6">
<field name="name" colspan="2"/>
<field name="company_id" groups="base.group_multi_company" colspan="2"/>
<newline/>
<separator string="Ranges" colspan="6"/>
<newline/>
<field name="range_ids" nolabel="1" colspan="6"/>
<newline/>
<separator string="KPIs" colspan="6"/>
<newline/>
<field name="kpi_ids" nolabel="1" colspan="6"/>
<newline/>
<separator string="Errors" attrs="{'invisible' : [('invalid_message', '=', False)]}" colspan="4"/>
<field name="invalid_message" nolabel="1" attrs="{'invisible' : [('invalid_message', '=', False)]}" colspan="4"/>
<newline/>
</group>
</sheet>
</form>
</field>
</record>
<record id="view_kpi_threshold_form" model="ir.ui.view">
<field name="name">kpi.threshold.form</field>
<field name="model">kpi.threshold</field>
<field name="arch" type="xml">
<form string="Threshold">
<sheet>
<group col="6" colspan="6">
<field name="name" colspan="2"/>
<field name="company_id" groups="base.group_multi_company" colspan="2"/>
<newline/>
<separator string="Ranges" colspan="6"/>
<newline/>
<field name="range_ids" nolabel="1" colspan="6"/>
<newline/>
<separator string="KPIs" colspan="6"/>
<newline/>
<field name="kpi_ids" nolabel="1" colspan="6"/>
<newline/>
<separator string="Errors" attrs="{'invisible' : [('invalid_message', '=', False)]}" colspan="4"/>
<field name="invalid_message" nolabel="1" attrs="{'invisible' : [('invalid_message', '=', False)]}" colspan="4"/>
<newline/>
</group>
</sheet>
</form>
</field>
</record>
<record model="ir.actions.act_window" id="open_threshold_list">
<field name="name">Thresholds</field>
<field name="res_model">kpi.threshold</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="view_kpi_threshold_tree"/>
</record>
</data>
<record model="ir.actions.act_window" id="open_threshold_list">
<field name="name">Thresholds</field>
<field name="res_model">kpi.threshold</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="view_kpi_threshold_tree"/>
</record>
</odoo>

View File

@@ -3,74 +3,69 @@
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>
<field name="model">kpi.threshold.range</field>
<field name="arch" type="xml">
<tree string="Ranges" decoration-danger="invalid_message">
<field name="name"/>
<field name="min_value"/>
<field name="max_value"/>
<field name="color" widget="color"/>
<field name="invalid_message"/>
<field name="company_id" groups="base.group_multi_company"/>
</tree>
</field>
</record>
<!-- Ranges -->
<record id="view_kpi_threshold_range_tree" model="ir.ui.view">
<field name="name">kpi.threshold.range.tree</field>
<field name="model">kpi.threshold.range</field>
<field name="arch" type="xml">
<tree string="Ranges" decoration-danger="invalid_message">
<field name="name"/>
<field name="min_value"/>
<field name="max_value"/>
<field name="color" widget="color"/>
<field name="invalid_message"/>
<field name="company_id" groups="base.group_multi_company"/>
</tree>
</field>
</record>
<record id="view_kpi_threshold_range_form" model="ir.ui.view">
<field name="name">kpi.threshold.range.form</field>
<field name="model">kpi.threshold.range</field>
<field name="arch" type="xml">
<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/>
<record id="view_kpi_threshold_range_form" model="ir.ui.view">
<field name="name">kpi.threshold.range.form</field>
<field name="model">kpi.threshold.range</field>
<field name="arch" type="xml">
<form string="Range">
<sheet>
<group col="6" colspan="6">
<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"/>
<newline/>
<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'))]}"/>
<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"/>
<field name="invalid_message" nolabel="1" attrs="{'invisible' : [('invalid_message', '=', False)]}" colspan="4"/>
</group>
</sheet>
</form>
</field>
</record>
<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'))]}"/>
<newline/>
<field name="min_error" colspan="6" attrs="{'invisible': [('min_error', '=', False)]}" />
<newline/>
<separator string="Maximum" colspan="4"/>
<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')]}"/>
<newline/>
<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/>
<separator string="Thresholds" colspan="4"/>
<field name="threshold_ids" nolabel="1" colspan="4"/>
<separator string="Errors" attrs="{'invisible' : [('invalid_message', '=', False)]}" colspan="4"/>
<field name="invalid_message" nolabel="1" attrs="{'invisible' : [('invalid_message', '=', False)]}" colspan="4"/>
</group>
</sheet>
</form>
</field>
</record>
<record model="ir.actions.act_window" id="open_threshold_range_list">
<field name="name">Ranges</field>
<field name="res_model">kpi.threshold.range</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="view_kpi_threshold_range_tree"/>
</record>
</data>
<record model="ir.actions.act_window" id="open_threshold_range_list">
<field name="name">Ranges</field>
<field name="res_model">kpi.threshold.range</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="view_kpi_threshold_range_tree"/>
</record>
</odoo>

View File

@@ -3,46 +3,44 @@
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"
sequence="15"
parent="base.menu_reporting_dashboard"
groups="base.group_user"/>
<menuitem id="menu_reporting_kpi"
name="KPI"
action="open_kpi_list"
sequence="15"
parent="base.menu_reporting_dashboard"
groups="base.group_user"/>
<menuitem id="menu_configuration_kpi"
name="KPI"
parent="base.menu_reporting_config"
groups="base.group_user"
sequence="20"/>
<menuitem id="menu_configuration_kpi"
name="KPI"
parent="base.menu_reporting_config"
groups="base.group_user"
sequence="20"/>
<menuitem id="menu_configuration_kpi_category"
name="Categories"
action="open_category_list"
parent="menu_configuration_kpi"
groups="base.group_user"
sequence="10"/>
<menuitem id="menu_configuration_kpi_category"
name="Categories"
action="open_category_list"
parent="menu_configuration_kpi"
groups="base.group_user"
sequence="10"/>
<menuitem id="menu_configuration_kpi_range"
name="Ranges"
action="open_threshold_range_list"
parent="menu_configuration_kpi"
groups="base.group_user"
sequence="20"/>
<menuitem id="menu_configuration_kpi_range"
name="Ranges"
action="open_threshold_range_list"
parent="menu_configuration_kpi"
groups="base.group_user"
sequence="20"/>
<menuitem id="menu_configuration_kpi_dbsource"
name="Data Sources"
action="base_external_dbsource.action_dbsource"
parent="menu_configuration_kpi"
groups="base.group_user"
sequence="20"/>
<menuitem id="menu_configuration_kpi_dbsource"
name="Data Sources"
action="base_external_dbsource.action_dbsource"
parent="menu_configuration_kpi"
groups="base.group_user"
sequence="20"/>
<menuitem id="menu_configuration_kpi_threshold"
name="Thresholds"
action="open_threshold_list"
parent="menu_configuration_kpi"
groups="base.group_user"
sequence="10"/>
</data>
<menuitem id="menu_configuration_kpi_threshold"
name="Thresholds"
action="open_threshold_list"
parent="menu_configuration_kpi"
groups="base.group_user"
sequence="10"/>
</odoo>