Skip to content

Commit 047c826

Browse files
committed
Merge PR #3464 into 18.0
Signed-off-by rvalyi
2 parents 39077df + f8b1b70 commit 047c826

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+2398
-0
lines changed

module_analysis/README.rst

Lines changed: 205 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,205 @@
1+
===============
2+
Module Analysis
3+
===============
4+
5+
..
6+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
7+
!! This file is generated by oca-gen-addon-readme !!
8+
!! changes will be overwritten. !!
9+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
10+
!! source digest: sha256:ae67870974ac7792dd300cb5ec41ece9c1bd971fff46551b50c790a809bf954a
11+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
12+
13+
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
14+
:target: https://odoo-community.org/page/development-status
15+
:alt: Beta
16+
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
17+
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
18+
:alt: License: AGPL-3
19+
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fserver--tools-lightgray.png?logo=github
20+
:target: https://github.com/OCA/server-tools/tree/18.0/module_analysis
21+
:alt: OCA/server-tools
22+
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
23+
:target: https://translation.odoo-community.org/projects/server-tools-18-0/server-tools-18-0-module_analysis
24+
:alt: Translate me on Weblate
25+
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
26+
:target: https://runboat.odoo-community.org/builds?repo=OCA/server-tools&target_branch=18.0
27+
:alt: Try me on Runboat
28+
29+
|badge1| |badge2| |badge3| |badge4| |badge5|
30+
31+
This module allows you to know 'how much code' is running on your Odoo
32+
instance, group by 'Type' (Odoo Core, OCA, other...)
33+
34+
This module can be usefull in the following cases :
35+
36+
- To analyse the size of your technical debt, regarding your Custom
37+
modules
38+
- To know the ratio between Odoo / OCA and Custom modules
39+
- To evaluate the amount to pay to odoo to upgrade your custom code, or
40+
the induced workload
41+
42+
|installed_modules_by_types|
43+
44+
For that purpose, it adds new concepts
45+
46+
- ``ir.module.author``, based on the value ``author`` present in the
47+
manifest file.
48+
49+
|module_authors|
50+
51+
- ``ir.module.type``, populated by default with Odoo and OCA values.
52+
53+
|module_types|
54+
55+
Each installed modules have extra data in the 'Technical Data' tab :
56+
57+
|module_form|
58+
59+
.. |installed_modules_by_types| image:: https://raw.githubusercontent.com/OCA/server-tools/18.0/module_analysis/static/description/installed_modules_by_types.png
60+
.. |module_authors| image:: https://raw.githubusercontent.com/OCA/server-tools/18.0/module_analysis/static/description/module_authors.png
61+
.. |module_types| image:: https://raw.githubusercontent.com/OCA/server-tools/18.0/module_analysis/static/description/module_types.png
62+
.. |module_form| image:: https://raw.githubusercontent.com/OCA/server-tools/18.0/module_analysis/static/description/module_form.png
63+
64+
**Table of contents**
65+
66+
.. contents::
67+
:local:
68+
69+
Installation
70+
============
71+
72+
To use this module, you have to install the ``pygount`` python librairy.
73+
74+
``pip install pygount``
75+
76+
Configuration
77+
=============
78+
79+
- Go to Apps / Module Analysis / Modules Types Rules
80+
81+
The Module types Rules are usefull to get the Type of a module, based on
82+
it information.
83+
84+
This module comes with default rules.
85+
86+
|default_module_type_rules|
87+
88+
You can add your custom rules to identify the modules your team have
89+
developped for exemple,
90+
91+
|add_module_type_rules|
92+
93+
to update the data manually, you have to :
94+
95+
- Go to 'Settings' / 'Technical' / 'Scheduled Actions'
96+
- Run manually the action : 'Update Module Analysis'
97+
98+
This will update analysis of your installed modules.
99+
100+
to update the data automatically, you have to :
101+
102+
- Go to 'Settings' / 'Technical' / 'Scheduled Actions'
103+
- Configure the action 'Update Module Analysis' and activate it. (By
104+
default, the cron is unactive and no analysis is done)
105+
106+
Adding Extra data
107+
-----------------
108+
109+
If you want to analyse other data, (for exemple, having the number of
110+
HTML files), create a custom modules and overload the module model :
111+
112+
.. code:: python
113+
114+
from odoo import api, fields, models
115+
116+
class IrModuleModule(models.Model):
117+
_inherit = 'ir.module.module'
118+
119+
xml_documentation_qty = fields.Integer(
120+
string='Quantity of Comments in XML Files')
121+
122+
@api.model
123+
def _get_analyse_settings(self):
124+
res = super()._get_analyse_settings()
125+
if not '.html' in res:
126+
res['.html'] = {}
127+
res['.html']['documentation'] 'xml_documentation_qty'
128+
return res
129+
130+
Exclude files and directories
131+
-----------------------------
132+
133+
Two parameters are availaible in 'Settings' / 'Technical' / 'Parameters'
134+
'System Parameters' :
135+
136+
|config_parameters|
137+
138+
The list of folders and filename will be exclude from the analysis. You
139+
can change the default settings.
140+
141+
.. |default_module_type_rules| image:: https://raw.githubusercontent.com/OCA/server-tools/18.0/module_analysis/static/description/default_module_type_rules.png
142+
.. |add_module_type_rules| image:: https://raw.githubusercontent.com/OCA/server-tools/18.0/module_analysis/static/description/add_module_type_rules.png
143+
.. |config_parameters| image:: https://raw.githubusercontent.com/OCA/server-tools/18.0/module_analysis/static/description/config_parameters.png
144+
145+
Usage
146+
=====
147+
148+
- Go to 'Apps' / 'Module Analysis' / 'Installed module by Types'
149+
150+
Open the stats to analyse the detail of the code installed
151+
152+
|analysis_pivot|
153+
154+
|analysis_pie|
155+
156+
.. |analysis_pivot| image:: https://raw.githubusercontent.com/OCA/server-tools/18.0/module_analysis/static/description/analysis_pivot.png
157+
.. |analysis_pie| image:: https://raw.githubusercontent.com/OCA/server-tools/18.0/module_analysis/static/description/analysis_pie.png
158+
159+
Bug Tracker
160+
===========
161+
162+
Bugs are tracked on `GitHub Issues <https://github.com/OCA/server-tools/issues>`_.
163+
In case of trouble, please check there if your issue has already been reported.
164+
If you spotted it first, help us to smash it by providing a detailed and welcomed
165+
`feedback <https://github.com/OCA/server-tools/issues/new?body=module:%20module_analysis%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
166+
167+
Do not contact contributors directly about support or help with technical issues.
168+
169+
Credits
170+
=======
171+
172+
Authors
173+
-------
174+
175+
* GRAP
176+
177+
Contributors
178+
------------
179+
180+
- Sylvain LE GAL (https://twitter.com/legalsylvain)
181+
182+
Maintainers
183+
-----------
184+
185+
This module is maintained by the OCA.
186+
187+
.. image:: https://odoo-community.org/logo.png
188+
:alt: Odoo Community Association
189+
:target: https://odoo-community.org
190+
191+
OCA, or the Odoo Community Association, is a nonprofit organization whose
192+
mission is to support the collaborative development of Odoo features and
193+
promote its widespread use.
194+
195+
.. |maintainer-legalsylvain| image:: https://github.com/legalsylvain.png?size=40px
196+
:target: https://github.com/legalsylvain
197+
:alt: legalsylvain
198+
199+
Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:
200+
201+
|maintainer-legalsylvain|
202+
203+
This module is part of the `OCA/server-tools <https://github.com/OCA/server-tools/tree/18.0/module_analysis>`_ project on GitHub.
204+
205+
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

module_analysis/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from . import models

module_analysis/__manifest__.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Copyright (C) 2019-Today: GRAP (<http://www.grap.coop/>)
2+
# @author: Sylvain LE GAL (https://twitter.com/legalsylvain)
3+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
4+
5+
{
6+
"name": "Module Analysis",
7+
"summary": "Add analysis tools regarding installed modules"
8+
" to know which installed modules comes from Odoo Core, OCA, or are"
9+
" custom modules",
10+
"author": "GRAP, Odoo Community Association (OCA)",
11+
"maintainers": ["legalsylvain"],
12+
"website": "https://github.com/OCA/server-tools",
13+
"version": "18.0.1.0.0",
14+
"license": "AGPL-3",
15+
"depends": ["base"],
16+
"data": [
17+
"security/ir.model.access.csv",
18+
"views/menu.xml",
19+
"views/view_ir_module_author.xml",
20+
"views/view_ir_module_type.xml",
21+
"views/view_ir_module_type_rule.xml",
22+
"views/view_ir_module_module.xml",
23+
"data/ir_config_parameter.xml",
24+
"data/ir_module_type.xml",
25+
"data/ir_module_type_rule.xml",
26+
"data/ir_cron.xml",
27+
],
28+
"external_dependencies": {
29+
"python": ["pygount"],
30+
},
31+
"installable": True,
32+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<!--
3+
Copyright (C) 2019-Today: GRAP (<http://www.grap.coop/>)
4+
@author: Sylvain LE GAL (https://twitter.com/legalsylvain)
5+
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
6+
-->
7+
<odoo noupdate="1">
8+
<record id="parameter_exclude_directories" model="ir.config_parameter">
9+
<field name="key">module_analysis.exclude_directories</field>
10+
<field name="value">lib,demo,test,tests,doc,description</field>
11+
</record>
12+
<record id="parameter_exclude_files" model="ir.config_parameter">
13+
<field name="key">module_analysis.exclude_files</field>
14+
<field name="value">__openerp__.py,__manifest__.py</field>
15+
</record>
16+
</odoo>

module_analysis/data/ir_cron.xml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<!--
3+
Copyright (C) 2021-Today: GRAP (<http://www.grap.coop/>)
4+
@author: Sylvain LE GAL (https://twitter.com/legalsylvain)
5+
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
6+
-->
7+
<odoo noupdate="1">
8+
<record id="cron_module_analysis" model="ir.cron">
9+
<field name="name">Update Module Analysis</field>
10+
<field name="active" eval="False" />
11+
<field name="model_id" ref="base.model_ir_module_module" />
12+
<field name="state">code</field>
13+
<field name="code">model.cron_analyse_code()</field>
14+
<field name="interval_number">1</field>
15+
<field name="interval_type">days</field>
16+
<field name="nextcall" eval="(DateTime.today()).strftime('%Y-%m-%d')" />
17+
<field name="user_id" ref="base.user_root" />
18+
</record>
19+
</odoo>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<!--
3+
Copyright (C) 2019-Today: GRAP (<http://www.grap.coop/>)
4+
@author: Sylvain LE GAL (https://twitter.com/legalsylvain)
5+
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
6+
-->
7+
<odoo>
8+
<record id="module_type_odoo" model="ir.module.type">
9+
<field name="name">Odoo Core</field>
10+
</record>
11+
<record id="module_type_oca" model="ir.module.type">
12+
<field name="name">OCA</field>
13+
</record>
14+
</odoo>
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<!--
3+
Copyright (C) 2019-Today: GRAP (<http://www.grap.coop/>)
4+
@author: Sylvain LE GAL (https://twitter.com/legalsylvain)
5+
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
6+
-->
7+
<odoo>
8+
<!-- Odoo Rules -->
9+
<record id="module_type_rule_odoo_a" model="ir.module.type.rule">
10+
<field name="sequence">1</field>
11+
<field name="module_domain">[('author_ids', 'ilike', 'Odoo S.A')]</field>
12+
<field name="module_type_id" ref="module_type_odoo" />
13+
</record>
14+
<record id="module_type_rule_odoo_b" model="ir.module.type.rule">
15+
<field name="sequence">2</field>
16+
<field name="module_domain">[('author_ids', 'ilike', 'OpenERP SA')]</field>
17+
<field name="module_type_id" ref="module_type_odoo" />
18+
</record>
19+
<record id="module_type_rule_odoo_c" model="ir.module.type.rule">
20+
<field name="sequence">3</field>
21+
<field name="module_domain">[('author_ids', '=', 'Odoo SA')]</field>
22+
<field name="module_type_id" ref="module_type_odoo" />
23+
</record>
24+
<record id="module_type_rule_odoo_d" model="ir.module.type.rule">
25+
<field name="sequence">4</field>
26+
<field name="module_domain">[('author_ids', '=', 'Odoo')]</field>
27+
<field name="module_type_id" ref="module_type_odoo" />
28+
</record>
29+
<!-- OCA Rules -->
30+
<record id="module_type_rule_oca_a" model="ir.module.type.rule">
31+
<field name="sequence">100</field>
32+
<field
33+
name="module_domain"
34+
>[('author_ids', '=', 'Odoo Community Association (OCA)')]</field>
35+
<field name="module_type_id" ref="module_type_oca" />
36+
</record>
37+
</odoo>

0 commit comments

Comments
 (0)