Skip to content

Commit 2c90170

Browse files
committed
[IMP] kpi: pre-commit auto fixes
1 parent e452b36 commit 2c90170

12 files changed

+117
-84
lines changed

kpi/README.rst

+28-29
Original file line numberDiff line numberDiff line change
@@ -17,32 +17,32 @@ Key Performance Indicator
1717
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
1818
:alt: License: AGPL-3
1919
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Freporting--engine-lightgray.png?logo=github
20-
:target: https://github.com/OCA/reporting-engine/tree/13.0/kpi
20+
:target: https://github.com/OCA/reporting-engine/tree/17.0/kpi
2121
:alt: OCA/reporting-engine
2222
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
23-
:target: https://translation.odoo-community.org/projects/reporting-engine-13-0/reporting-engine-13-0-kpi
23+
:target: https://translation.odoo-community.org/projects/reporting-engine-17-0/reporting-engine-17-0-kpi
2424
:alt: Translate me on Weblate
2525
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
26-
:target: https://runboat.odoo-community.org/builds?repo=OCA/reporting-engine&target_branch=13.0
26+
:target: https://runboat.odoo-community.org/builds?repo=OCA/reporting-engine&target_branch=17.0
2727
:alt: Try me on Runboat
2828

2929
|badge1| |badge2| |badge3| |badge4| |badge5|
3030

3131
This module provides the basis for creating key performance indicators,
32-
including static and dynamic thresholds (SQL query or Python code),
33-
on local and remote data sources.
32+
including static and dynamic thresholds (SQL query or Python code), on
33+
local and remote data sources.
3434

35-
The module also provides the mecanism to update KPIs automatically.
36-
A scheduler is executed every hour and updates the KPI values, based
37-
on the periodicity of each KPI. KPI computation can also be done
38-
manually.
35+
The module also provides the mecanism to update KPIs automatically. A
36+
scheduler is executed every hour and updates the KPI values, based on
37+
the periodicity of each KPI. KPI computation can also be done manually.
3938

4039
A threshold is a list of ranges and a range is:
4140

42-
* a name (like Good, Warning, Bad)
43-
* a minimum value (fixed, sql query or python code)
44-
* a maximum value (fixed, sql query or python code)
45-
* color (RGB code like #00FF00 for green, #FFA500 for orange, #FF0000 for red)
41+
- a name (like Good, Warning, Bad)
42+
- a minimum value (fixed, sql query or python code)
43+
- a maximum value (fixed, sql query or python code)
44+
- color (RGB code like #00FF00 for green, #FFA500 for orange, #FF0000
45+
for red)
4646

4747
**Table of contents**
4848

@@ -52,43 +52,42 @@ A threshold is a list of ranges and a range is:
5252
Usage
5353
=====
5454

55-
Example of usage:
56-
https://www.youtube.com/watch?v=OC4-y2klzIk
55+
Example of usage: https://www.youtube.com/watch?v=OC4-y2klzIk
5756

5857
Bug Tracker
5958
===========
6059

6160
Bugs are tracked on `GitHub Issues <https://github.com/OCA/reporting-engine/issues>`_.
6261
In case of trouble, please check there if your issue has already been reported.
6362
If you spotted it first, help us to smash it by providing a detailed and welcomed
64-
`feedback <https://github.com/OCA/reporting-engine/issues/new?body=module:%20kpi%0Aversion:%2013.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
63+
`feedback <https://github.com/OCA/reporting-engine/issues/new?body=module:%20kpi%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
6564

6665
Do not contact contributors directly about support or help with technical issues.
6766

6867
Credits
6968
=======
7069

7170
Authors
72-
~~~~~~~
71+
-------
7372

7473
* Savoir-faire Linux
7574

7675
Contributors
77-
~~~~~~~~~~~~
76+
------------
7877

79-
* Daniel Reis <dreis.pt@hotmail.com>
80-
* Glen Dromgoole <gdromgoole@tier1engineering.com>
81-
* Loic Lacroix <loic.lacroix@savoirfairelinux.com>
82-
* Sandy Carter <sandy.carter@savoirfairelinux.com>
83-
* Gervais Naoussi <gervaisnaoussi@gmail.com>
84-
* Iván Todorovich <ivan.todorovich@gmail.com>
85-
* Adrià Gil <adria.gil@eficent.com>
86-
* `Guadaltech <https://www.guadaltech.es>`_:
78+
- Daniel Reis <dreis.pt@hotmail.com>
79+
- Glen Dromgoole <gdromgoole@tier1engineering.com>
80+
- Loic Lacroix <loic.lacroix@savoirfairelinux.com>
81+
- Sandy Carter <sandy.carter@savoirfairelinux.com>
82+
- Gervais Naoussi <gervaisnaoussi@gmail.com>
83+
- Iván Todorovich <ivan.todorovich@gmail.com>
84+
- Adrià Gil <adria.gil@eficent.com>
85+
- `Guadaltech <https://www.guadaltech.es>`__:
8786

88-
* Fernando La Chica <fernando.lachica@guadaltech.es>
87+
- Fernando La Chica <fernando.lachica@guadaltech.es>
8988

9089
Maintainers
91-
~~~~~~~~~~~
90+
-----------
9291

9392
This module is maintained by the OCA.
9493

@@ -100,6 +99,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
10099
mission is to support the collaborative development of Odoo features and
101100
promote its widespread use.
102101

103-
This module is part of the `OCA/reporting-engine <https://github.com/OCA/reporting-engine/tree/13.0/kpi>`_ project on GitHub.
102+
This module is part of the `OCA/reporting-engine <https://github.com/OCA/reporting-engine/tree/17.0/kpi>`_ project on GitHub.
104103

105104
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

kpi/models/kpi.py

+33-8
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,16 @@ class KPI(models.Model):
5656

5757
name = fields.Char("Name", required=True)
5858
description = fields.Text("Description")
59-
category_id = fields.Many2one("kpi.category", "Category", required=True,)
60-
threshold_id = fields.Many2one("kpi.threshold", "Threshold", required=True,)
59+
category_id = fields.Many2one(
60+
"kpi.category",
61+
"Category",
62+
required=True,
63+
)
64+
threshold_id = fields.Many2one(
65+
"kpi.threshold",
66+
"Threshold",
67+
required=True,
68+
)
6169
periodicity = fields.Integer("Periodicity", default=1)
6270

6371
periodicity_uom = fields.Selection(
@@ -73,11 +81,21 @@ class KPI(models.Model):
7381
default="day",
7482
)
7583

76-
next_execution_date = fields.Datetime("Next execution date", readonly=True,)
77-
value = fields.Float(string="Value", compute="_compute_display_last_kpi_value",)
78-
color = fields.Text("Color", compute="_compute_display_last_kpi_value",)
84+
next_execution_date = fields.Datetime(
85+
"Next execution date",
86+
readonly=True,
87+
)
88+
value = fields.Float(
89+
string="Value",
90+
compute="_compute_display_last_kpi_value",
91+
)
92+
color = fields.Text(
93+
"Color",
94+
compute="_compute_display_last_kpi_value",
95+
)
7996
last_execution = fields.Datetime(
80-
"Last execution", compute="_compute_display_last_kpi_value",
97+
"Last execution",
98+
compute="_compute_display_last_kpi_value",
8199
)
82100
kpi_type = fields.Selection(
83101
[
@@ -88,14 +106,21 @@ class KPI(models.Model):
88106
"KPI Computation Type",
89107
)
90108

91-
dbsource_id = fields.Many2one("base.external.dbsource", "External DB Source",)
109+
dbsource_id = fields.Many2one(
110+
"base.external.dbsource",
111+
"External DB Source",
112+
)
92113
kpi_code = fields.Text(
93114
"KPI Code",
94115
help=(
95116
"SQL code must return the result as 'value' " "(i.e. 'SELECT 5 AS value')."
96117
),
97118
)
98-
history_ids = fields.One2many("kpi.history", "kpi_id", "History",)
119+
history_ids = fields.One2many(
120+
"kpi.history",
121+
"kpi_id",
122+
"History",
123+
)
99124
active = fields.Boolean(
100125
"Active",
101126
help=(

kpi/models/kpi_history.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,12 @@ class KPIHistory(models.Model):
1111
_description = "History of the KPI"
1212
_order = "date desc"
1313

14-
name = fields.Char("Name", size=150, required=True, default=fields.Datetime.now(),)
14+
name = fields.Char(
15+
"Name",
16+
size=150,
17+
required=True,
18+
default=fields.Datetime.now(),
19+
)
1520
kpi_id = fields.Many2one("kpi", "KPI", required=True)
1621
date = fields.Datetime(
1722
"Execution Date",

kpi/models/kpi_threshold_range.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@ def _selection_value_type(self):
7373
min_code = fields.Text("Minimum Computation Code")
7474
min_error = fields.Char("Minimum Error", compute="_compute_min_value")
7575
min_dbsource_id = fields.Many2one(
76-
"base.external.dbsource", "External DB Source Minimum",
76+
"base.external.dbsource",
77+
"External DB Source Minimum",
7778
)
7879
max_type = fields.Selection(
7980
selection="_selection_value_type", string="Max Type", required=True
@@ -83,7 +84,8 @@ def _selection_value_type(self):
8384
max_code = fields.Text("Maximum Computation Code")
8485
max_error = fields.Char("Maximum Error", compute="_compute_max_value")
8586
max_dbsource_id = fields.Many2one(
86-
"base.external.dbsource", "External DB Source Maximum",
87+
"base.external.dbsource",
88+
"External DB Source Maximum",
8789
)
8890

8991
color = fields.Char(string="Color", help="Choose your color")

kpi/pyproject.toml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[build-system]
2+
requires = ["whool"]
3+
build-backend = "whool.buildapi"

kpi/readme/CONTRIBUTORS.md

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
- Daniel Reis \<<dreis.pt@hotmail.com>\>
2+
- Glen Dromgoole \<<gdromgoole@tier1engineering.com>\>
3+
- Loic Lacroix \<<loic.lacroix@savoirfairelinux.com>\>
4+
- Sandy Carter \<<sandy.carter@savoirfairelinux.com>\>
5+
- Gervais Naoussi \<<gervaisnaoussi@gmail.com>\>
6+
- Iván Todorovich \<<ivan.todorovich@gmail.com>\>
7+
- Adrià Gil \<<adria.gil@eficent.com>\>
8+
- [Guadaltech](https://www.guadaltech.es):
9+
- Fernando La Chica \<<fernando.lachica@guadaltech.es>\>

kpi/readme/CONTRIBUTORS.rst

-10
This file was deleted.

kpi/readme/DESCRIPTION.md

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

kpi/readme/DESCRIPTION.rst

-15
This file was deleted.

kpi/readme/USAGE.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Example of usage: <https://www.youtube.com/watch?v=OC4-y2klzIk>

kpi/readme/USAGE.rst

-2
This file was deleted.

kpi/static/description/index.html

+18-17
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
<?xml version="1.0" encoding="utf-8"?>
21
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
32
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
43
<head>
@@ -9,10 +8,11 @@
98

109
/*
1110
:Author: David Goodger (goodger@python.org)
12-
:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $
11+
:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $
1312
:Copyright: This stylesheet has been placed in the public domain.
1413
1514
Default cascading style sheet for the HTML output of Docutils.
15+
Despite the name, some widely supported CSS2 features are used.
1616
1717
See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
1818
customize this style sheet.
@@ -275,7 +275,7 @@
275275
margin-left: 2em ;
276276
margin-right: 2em }
277277

278-
pre.code .ln { color: grey; } /* line numbers */
278+
pre.code .ln { color: gray; } /* line numbers */
279279
pre.code, code { background-color: #eeeeee }
280280
pre.code .comment, code .comment { color: #5C6576 }
281281
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
@@ -301,7 +301,7 @@
301301
span.pre {
302302
white-space: pre }
303303

304-
span.problematic {
304+
span.problematic, pre.problematic {
305305
color: red }
306306

307307
span.section-subtitle {
@@ -369,20 +369,20 @@ <h1 class="title">Key Performance Indicator</h1>
369369
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
370370
!! source digest: sha256:cfa60f307c1347dd86421388daf4ddf0cef49cfe864c034368a4b031d2dc045c
371371
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
372-
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/reporting-engine/tree/13.0/kpi"><img alt="OCA/reporting-engine" src="https://img.shields.io/badge/github-OCA%2Freporting--engine-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/reporting-engine-13-0/reporting-engine-13-0-kpi"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/reporting-engine&amp;target_branch=13.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
372+
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/reporting-engine/tree/17.0/kpi"><img alt="OCA/reporting-engine" src="https://img.shields.io/badge/github-OCA%2Freporting--engine-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/reporting-engine-17-0/reporting-engine-17-0-kpi"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/reporting-engine&amp;target_branch=17.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
373373
<p>This module provides the basis for creating key performance indicators,
374-
including static and dynamic thresholds (SQL query or Python code),
375-
on local and remote data sources.</p>
376-
<p>The module also provides the mecanism to update KPIs automatically.
377-
A scheduler is executed every hour and updates the KPI values, based
378-
on the periodicity of each KPI. KPI computation can also be done
379-
manually.</p>
374+
including static and dynamic thresholds (SQL query or Python code), on
375+
local and remote data sources.</p>
376+
<p>The module also provides the mecanism to update KPIs automatically. A
377+
scheduler is executed every hour and updates the KPI values, based on
378+
the periodicity of each KPI. KPI computation can also be done manually.</p>
380379
<p>A threshold is a list of ranges and a range is:</p>
381380
<ul class="simple">
382381
<li>a name (like Good, Warning, Bad)</li>
383382
<li>a minimum value (fixed, sql query or python code)</li>
384383
<li>a maximum value (fixed, sql query or python code)</li>
385-
<li>color (RGB code like #00FF00 for green, #FFA500 for orange, #FF0000 for red)</li>
384+
<li>color (RGB code like #00FF00 for green, #FFA500 for orange, #FF0000
385+
for red)</li>
386386
</ul>
387387
<p><strong>Table of contents</strong></p>
388388
<div class="contents local topic" id="contents">
@@ -399,15 +399,14 @@ <h1 class="title">Key Performance Indicator</h1>
399399
</div>
400400
<div class="section" id="usage">
401401
<h1><a class="toc-backref" href="#toc-entry-1">Usage</a></h1>
402-
<p>Example of usage:
403-
<a class="reference external" href="https://www.youtube.com/watch?v=OC4-y2klzIk">https://www.youtube.com/watch?v=OC4-y2klzIk</a></p>
402+
<p>Example of usage: <a class="reference external" href="https://www.youtube.com/watch?v=OC4-y2klzIk">https://www.youtube.com/watch?v=OC4-y2klzIk</a></p>
404403
</div>
405404
<div class="section" id="bug-tracker">
406405
<h1><a class="toc-backref" href="#toc-entry-2">Bug Tracker</a></h1>
407406
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/reporting-engine/issues">GitHub Issues</a>.
408407
In case of trouble, please check there if your issue has already been reported.
409408
If you spotted it first, help us to smash it by providing a detailed and welcomed
410-
<a class="reference external" href="https://github.com/OCA/reporting-engine/issues/new?body=module:%20kpi%0Aversion:%2013.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
409+
<a class="reference external" href="https://github.com/OCA/reporting-engine/issues/new?body=module:%20kpi%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
411410
<p>Do not contact contributors directly about support or help with technical issues.</p>
412411
</div>
413412
<div class="section" id="credits">
@@ -437,11 +436,13 @@ <h2><a class="toc-backref" href="#toc-entry-5">Contributors</a></h2>
437436
<div class="section" id="maintainers">
438437
<h2><a class="toc-backref" href="#toc-entry-6">Maintainers</a></h2>
439438
<p>This module is maintained by the OCA.</p>
440-
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
439+
<a class="reference external image-reference" href="https://odoo-community.org">
440+
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
441+
</a>
441442
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
442443
mission is to support the collaborative development of Odoo features and
443444
promote its widespread use.</p>
444-
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/reporting-engine/tree/13.0/kpi">OCA/reporting-engine</a> project on GitHub.</p>
445+
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/reporting-engine/tree/17.0/kpi">OCA/reporting-engine</a> project on GitHub.</p>
445446
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
446447
</div>
447448
</div>

0 commit comments

Comments
 (0)