Browse Source

[ADD] new module module_analysis

12.0
Sylvain LE GAL 6 years ago
committed by OCA-git-bot
parent
commit
3250ead748
  1. 129
      module_analysis/README.rst
  2. 1
      module_analysis/__init__.py
  3. 33
      module_analysis/__manifest__.py
  4. 18
      module_analysis/data/ir_module_type.xml
  5. 42
      module_analysis/data/ir_module_type_rule.xml
  6. 5
      module_analysis/models/__init__.py
  7. 18
      module_analysis/models/base_module_update.py
  8. 44
      module_analysis/models/ir_module_author.py
  9. 124
      module_analysis/models/ir_module_module.py
  10. 25
      module_analysis/models/ir_module_type.py
  11. 30
      module_analysis/models/ir_module_type_rule.py
  12. 25
      module_analysis/readme/CONFIGURE.rst
  13. 1
      module_analysis/readme/CONTRIBUTORS.rst
  14. 26
      module_analysis/readme/DESCRIPTION.rst
  15. 5
      module_analysis/readme/INSTALL.rst
  16. 5
      module_analysis/readme/USAGE.rst
  17. 4
      module_analysis/security/ir.model.access.csv
  18. BIN
      module_analysis/static/description/add_module_type_rules.png
  19. BIN
      module_analysis/static/description/analysis.png
  20. BIN
      module_analysis/static/description/base_module_update.png
  21. BIN
      module_analysis/static/description/default_module_type_rules.png
  22. BIN
      module_analysis/static/description/icon.png
  23. BIN
      module_analysis/static/description/installed_modules_by_types.png
  24. BIN
      module_analysis/static/description/module_authors.png
  25. BIN
      module_analysis/static/description/module_form.png
  26. BIN
      module_analysis/static/description/module_types.png
  27. 15
      module_analysis/views/menu.xml
  28. 20
      module_analysis/views/view_base_module_update.xml
  29. 54
      module_analysis/views/view_ir_module_author.xml
  30. 58
      module_analysis/views/view_ir_module_module.xml
  31. 50
      module_analysis/views/view_ir_module_type.xml
  32. 34
      module_analysis/views/view_ir_module_type_rule.xml

129
module_analysis/README.rst

@ -0,0 +1,129 @@
===============
Module Analysis
===============
.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! 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-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-legalsylvain%2Fserver--tools-lightgray.png?logo=github
:target: https://github.com/legalsylvain/server-tools/tree/12.0-ADD-module_analysis/module_analysis
:alt: legalsylvain/server-tools
|badge1| |badge2| |badge3|
This module allows you to know 'how much code' is running on your Odoo
instance, group by 'Type' (Odoo Core, OCA, other...)
This module can be usefull in the following cases :
* To analyse the size of your technical debt, regarding your Custom modules
* To know the ratio between Odoo / OCA and Custom modules
* To evaluate the amount to pay to odoo to upgrade your custom code, or the
induced workload
.. image:: https://raw.githubusercontent.com/legalsylvain/server-tools/12.0-ADD-module_analysis/module_analysis/static/description/installed_modules_by_types.png
For that purpose, it adds new concepts
* ``ir.module.author``, based on the value ``author`` present in the manifest
file.
.. image:: https://raw.githubusercontent.com/legalsylvain/server-tools/12.0-ADD-module_analysis/module_analysis/static/description/module_authors.png
* ``ir.module.type``, populated by default with Odoo and OCA values.
.. image:: https://raw.githubusercontent.com/legalsylvain/server-tools/12.0-ADD-module_analysis/module_analysis/static/description/module_types.png
Each installed modules have extra data in the 'Technical Data' tab :
.. image:: https://raw.githubusercontent.com/legalsylvain/server-tools/12.0-ADD-module_analysis/module_analysis/static/description/module_form.png
**Table of contents**
.. contents::
:local:
Installation
============
To use this module, you have to install the application ``cloc``
.. code-block:: shell
sudo apt-get install cloc
Configuration
=============
* Go to Apps / Module Analysis / Modules Types Rules
The Module types Rules are usefull to get the Type of a module, based on
it information.
This module comes with default rules.
.. image:: https://raw.githubusercontent.com/legalsylvain/server-tools/12.0-ADD-module_analysis/module_analysis/static/description/default_module_type_rules.png
You can add your custom rules to identify the modules your team have
developped for exemple,
.. image:: https://raw.githubusercontent.com/legalsylvain/server-tools/12.0-ADD-module_analysis/module_analysis/static/description/add_module_type_rules.png
to update the data, you have to :
* Go to 'Apps' / 'Update Apps List'
* Check the box 'Analyse Installed modules'
.. image:: https://raw.githubusercontent.com/legalsylvain/server-tools/12.0-ADD-module_analysis/module_analysis/static/description/base_module_update.png
This will update analysis of your installed module.
Usage
=====
* Go to 'Apps' / 'Module Analysis' / 'Installed module by Types'
Open the stats to analyze the detail of the code installed
.. image:: https://raw.githubusercontent.com/legalsylvain/server-tools/12.0-ADD-module_analysis/module_analysis/static/description/default_module_type_rules.png
Bug Tracker
===========
Bugs are tracked on `GitHub Issues <https://github.com/legalsylvain/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/legalsylvain/server-tools/issues/new?body=module:%20module_analysis%0Aversion:%2012.0-ADD-module_analysis%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
=======
Authors
~~~~~~~
* GRAP
Contributors
~~~~~~~~~~~~
* Sylvain LE GAL (https://twitter.com/legalsylvain)
Maintainers
~~~~~~~~~~~
This module is part of the `legalsylvain/server-tools <https://github.com/legalsylvain/server-tools/tree/12.0-ADD-module_analysis/module_analysis>`_ project on GitHub.
You are welcome to contribute.

1
module_analysis/__init__.py

@ -0,0 +1 @@
from . import models

33
module_analysis/__manifest__.py

@ -0,0 +1,33 @@
# Copyright (C) 2019-Today: GRAP (<http://www.grap.coop/>)
# @author: Sylvain LE GAL (https://twitter.com/legalsylvain)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
'name': "Module Analysis",
'summary': "Add analysis tools regarding installed modules"
" to know which installed modules comes from Odoo Core, OCA, or are"
" custom modules",
'author': 'GRAP, Odoo Community Association (OCA)',
'website': "https://github.com/OCA/server-tools/",
'version': '12.0.1.0.0',
'license': 'AGPL-3',
'depends': [
'base',
],
'data': [
'security/ir.model.access.csv',
'views/menu.xml',
'views/view_base_module_update.xml',
'views/view_ir_module_author.xml',
'views/view_ir_module_type.xml',
'views/view_ir_module_type_rule.xml',
'views/view_ir_module_module.xml',
'data/ir_module_type.xml',
'data/ir_module_type_rule.xml',
],
'external_dependencies': {
'lib': ['cloc'],
},
'installable': True,
}

18
module_analysis/data/ir_module_type.xml

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2019-Today: GRAP (<http://www.grap.coop/>)
@author: Sylvain LE GAL (https://twitter.com/legalsylvain)
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
-->
<odoo>
<record id="module_type_odoo" model="ir.module.type">
<field name="name">Odoo Core</field>
</record>
<record id="module_type_oca" model="ir.module.type">
<field name="name">OCA</field>
</record>
</odoo>

42
module_analysis/data/ir_module_type_rule.xml

@ -0,0 +1,42 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2019-Today: GRAP (<http://www.grap.coop/>)
@author: Sylvain LE GAL (https://twitter.com/legalsylvain)
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
-->
<odoo>
<!-- Odoo Rules -->
<record id="module_type_rule_odoo_a" model="ir.module.type.rule">
<field name="sequence">1</field>
<field name="module_domain">[('author_ids', 'ilike', 'Odoo S.A')]</field>
<field name="module_type_id" ref="module_type_odoo"/>
</record>
<record id="module_type_rule_odoo_b" model="ir.module.type.rule">
<field name="sequence">2</field>
<field name="module_domain">[('author_ids', 'ilike', 'OpenERP SA')]</field>
<field name="module_type_id" ref="module_type_odoo"/>
</record>
<record id="module_type_rule_odoo_c" model="ir.module.type.rule">
<field name="sequence">3</field>
<field name="module_domain">[('author_ids', '=', 'Odoo SA')]</field>
<field name="module_type_id" ref="module_type_odoo"/>
</record>
<record id="module_type_rule_odoo_d" model="ir.module.type.rule">
<field name="sequence">4</field>
<field name="module_domain">[('author_ids', '=', 'Odoo')]</field>
<field name="module_type_id" ref="module_type_odoo"/>
</record>
<!-- OCA Rules -->
<record id="module_type_rule_oca_a" model="ir.module.type.rule">
<field name="sequence">100</field>
<field name="module_domain">[('author_ids', '=', 'Odoo Community Association (OCA)')]</field>
<field name="module_type_id" ref="module_type_oca"/>
</record>
</odoo>

5
module_analysis/models/__init__.py

@ -0,0 +1,5 @@
from . import base_module_update
from . import ir_module_author
from . import ir_module_module
from . import ir_module_type
from . import ir_module_type_rule

18
module_analysis/models/base_module_update.py

@ -0,0 +1,18 @@
# Copyright (C) 2019-Today: GRAP (<http://www.grap.coop/>)
# @author: Sylvain LE GAL (https://twitter.com/legalsylvain)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import api, fields, models
class BaseModuleUpdate(models.TransientModel):
_inherit = 'base.module.update'
analyze_installed_modules = fields.Boolean(
string='Analyze Installed Modules', default=True)
@api.multi
def update_module(self):
return super(BaseModuleUpdate, self.with_context(
analyze_installed_modules=self.analyze_installed_modules)
).update_module()

44
module_analysis/models/ir_module_author.py

@ -0,0 +1,44 @@
# Copyright (C) 2019-Today: GRAP (<http://www.grap.coop/>)
# @author: Sylvain LE GAL (https://twitter.com/legalsylvain)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import api, fields, models
class IrModuleAuthor(models.Model):
_name = 'ir.module.author'
_description = 'Modules Authors'
name = fields.Char(string='Name', required=True)
module_ids = fields.Many2many(
string='Modules', comodel_name='ir.module.module')
module_qty = fields.Integer(
string="Modules Quantity",
compute='_compute_modules', store=True)
installed_module_qty = fields.Integer(
string="Installed Modules Quantity",
compute='_compute_modules', store=True)
_sql_constraints = [
('name_uniq', 'unique(name)',
'The name of the modules author should be unique per database!'),
]
@api.multi
@api.depends('module_ids')
def _compute_modules(self):
for author in self:
author.module_qty = len(author.module_ids)
author.installed_module_qty = len(
author.module_ids.filtered(lambda x: x.state == 'installed'))
@api.model
def _get_or_create(self, name):
authors = self.search([('name', '=', name)])
if authors:
return authors[0]
else:
return self.create({'name': name})

124
module_analysis/models/ir_module_module.py

@ -0,0 +1,124 @@
# Copyright (C) 2019-Today: GRAP (<http://www.grap.coop/>)
# @author: Sylvain LE GAL (https://twitter.com/legalsylvain)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
import json
import logging
import os
import subprocess
from odoo import api, fields, models
from odoo.tools.safe_eval import safe_eval
from odoo.modules.module import get_module_path
_logger = logging.getLogger(__name__)
class IrModuleModule(models.Model):
_inherit = 'ir.module.module'
author_ids = fields.Many2many(
string='Authors', comodel_name='ir.module.author', readonly=True)
module_type_id = fields.Many2one(
string='Module Type', comodel_name='ir.module.type', readonly=True)
python_lines_qty = fields.Integer(string='Python Lines', readonly=True)
xml_lines_qty = fields.Integer(string='XML Lines', readonly=True)
js_lines_qty = fields.Integer(string='JS Lines', readonly=True)
css_lines_qty = fields.Integer(string='CSS Lines', readonly=True)
@api.model
def update_list(self):
res = super(IrModuleModule, self).update_list()
if self.env.context.get('analyze_installed_modules', False):
self.search([('state', '=', 'installed')]).button_analyze_code()
return res
@api.multi
def write(self, vals):
res = super(IrModuleModule, self).write(vals)
if vals.get('state', False) == 'installed':
self.button_analyze_code()
elif vals.get('state', False) == 'uninstalled':
self.write({
'author_ids': [6, 0, []],
'module_type_id': False,
'python_lines_qty': False,
'xml_lines_qty': 0,
'js_lines_qty': 0,
'css_lines_qty': 0,
})
return res
@api.multi
def button_analyze_code(self):
IrModuleAuthor = self.env['ir.module.author']
IrModuleTypeRule = self.env['ir.module.type.rule']
rules = IrModuleTypeRule.search([])
exclude_dir = "lib,description,tests,demo"
include_lang = self._get_analyzed_languages()
for module in self:
_logger.info("Analyzing Code for module %s" % (module.name))
# Update Authors, based on manifest key
authors = []
if module.author and module.author[0] == '[':
author_txt_list = safe_eval(module.author)
else:
author_txt_list = module.author.split(',')
author_txt_list = [x.strip() for x in author_txt_list]
author_txt_list = [x for x in author_txt_list if x]
for author_txt in author_txt_list:
authors.append(IrModuleAuthor._get_or_create(author_txt))
author_ids = [x.id for x in authors]
module.author_ids = author_ids
# Update Module Type, based on rules
module_type_id = rules._get_module_type_id_from_module(module)
module.module_type_id = module_type_id
# Get Path of module folder and parse the code
path = get_module_path(module.name)
try:
command = [
'cloc',
'--exclude-dir=%s' % (exclude_dir),
'--skip-uniqueness',
'--include-lang=%s' % (include_lang),
'--not-match-f="__openerp__.py|__manifest__.py"',
'--json',
os.path.join(path)]
temp = subprocess.Popen(command, stdout=subprocess.PIPE)
bytes_output = temp.communicate()
output = bytes_output[0].decode("utf-8").replace('\n', '')
json_res = json.loads(output)
values = self._prepare_values_from_json(json_res)
module.write(values)
except Exception as e:
_logger.warning(
'Failed to execute the cloc command on module %s',
module.name, e.message())
@api.model
def _get_analyzed_languages(self):
"Overload the function to add extra languages to analyze"
return "Python,XML,JavaScript,CSS"
@api.model
def _prepare_values_from_json(self, json_value):
return {
'python_lines_qty': json_value.get('Python', {}).get('code', 0),
'xml_lines_qty': json_value.get('XML', {}).get('code', 0),
'js_lines_qty': json_value.get('JavaScript', {}).get('code', 0),
'css_lines_qty': json_value.get('CSS', {}).get('code', 0),
}

25
module_analysis/models/ir_module_type.py

@ -0,0 +1,25 @@
# Copyright (C) 2019-Today: GRAP (<http://www.grap.coop/>)
# @author: Sylvain LE GAL (https://twitter.com/legalsylvain)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import api, fields, models
class IrModuleType(models.Model):
_name = 'ir.module.type'
_description = 'Modules Types'
name = fields.Char(string='Name', required=True)
module_ids = fields.One2many(
string='Modules', comodel_name='ir.module.module',
inverse_name='module_type_id')
module_qty = fields.Integer(
string='Modules Quantity', compute='_compute_module_qty', store=True)
@api.multi
@api.depends('module_ids.module_type_id')
def _compute_module_qty(self):
for module_type in self:
module_type.module_qty = len(module_type.module_ids)

30
module_analysis/models/ir_module_type_rule.py

@ -0,0 +1,30 @@
# Copyright (C) 2019-Today: GRAP (<http://www.grap.coop/>)
# @author: Sylvain LE GAL (https://twitter.com/legalsylvain)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import api, fields, models
from odoo.tools.safe_eval import safe_eval
class IrModuleType(models.Model):
_name = 'ir.module.type.rule'
_description = 'Modules Types Rules'
_order = 'sequence'
sequence = fields.Integer(string='Sequence')
module_domain = fields.Char(
string='Module Domain', required=True, default='[]')
module_type_id = fields.Many2one(
string='Module type', comodel_name='ir.module.type', required=True)
@api.multi
def _get_module_type_id_from_module(self, module):
IrModuleModule = self.env['ir.module.module']
for rule in self:
domain = safe_eval(rule.module_domain)
domain.append(('id', '=', module.id))
if IrModuleModule.search(domain):
return rule.module_type_id.id
return False

25
module_analysis/readme/CONFIGURE.rst

@ -0,0 +1,25 @@
* Go to Apps / Module Analysis / Modules Types Rules
The Module types Rules are usefull to get the Type of a module, based on
it information.
This module comes with default rules.
.. image:: ../static/description/default_module_type_rules.png
You can add your custom rules to identify the modules your team have
developped for exemple,
.. image:: ../static/description/add_module_type_rules.png
to update the data, you have to :
* Go to 'Apps' / 'Update Apps List'
* Check the box 'Analyse Installed modules'
.. image:: ../static/description/base_module_update.png
This will update analysis of your installed module.

1
module_analysis/readme/CONTRIBUTORS.rst

@ -0,0 +1 @@
* Sylvain LE GAL (https://twitter.com/legalsylvain)

26
module_analysis/readme/DESCRIPTION.rst

@ -0,0 +1,26 @@
This module allows you to know 'how much code' is running on your Odoo
instance, group by 'Type' (Odoo Core, OCA, other...)
This module can be usefull in the following cases :
* To analyse the size of your technical debt, regarding your Custom modules
* To know the ratio between Odoo / OCA and Custom modules
* To evaluate the amount to pay to odoo to upgrade your custom code, or the
induced workload
.. image:: ../static/description/installed_modules_by_types.png
For that purpose, it adds new concepts
* ``ir.module.author``, based on the value ``author`` present in the manifest
file.
.. image:: ../static/description/module_authors.png
* ``ir.module.type``, populated by default with Odoo and OCA values.
.. image:: ../static/description/module_types.png
Each installed modules have extra data in the 'Technical Data' tab :
.. image:: ../static/description/module_form.png

5
module_analysis/readme/INSTALL.rst

@ -0,0 +1,5 @@
To use this module, you have to install the application ``cloc``
.. code-block:: shell
sudo apt-get install cloc

5
module_analysis/readme/USAGE.rst

@ -0,0 +1,5 @@
* Go to 'Apps' / 'Module Analysis' / 'Installed module by Types'
Open the stats to analyze the detail of the code installed
.. image:: ../static/description/default_module_type_rules.png

4
module_analysis/security/ir.model.access.csv

@ -0,0 +1,4 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_ir_module_author_manager,ir_module_author_manager,model_ir_module_author,base.group_system,1,1,1,1
access_ir_module_type_manager,ir_module_type_manager,model_ir_module_type,base.group_system,1,1,1,1
access_ir_module_type_rule_manager,ir_module_type_rule_manager,model_ir_module_type_rule,base.group_system,1,1,1,1

BIN
module_analysis/static/description/add_module_type_rules.png

After

Width: 914  |  Height: 298  |  Size: 34 KiB

BIN
module_analysis/static/description/analysis.png

After

Width: 578  |  Height: 404  |  Size: 34 KiB

BIN
module_analysis/static/description/base_module_update.png

After

Width: 530  |  Height: 214  |  Size: 9.1 KiB

BIN
module_analysis/static/description/default_module_type_rules.png

After

Width: 841  |  Height: 268  |  Size: 29 KiB

BIN
module_analysis/static/description/icon.png

After

Width: 128  |  Height: 128  |  Size: 9.2 KiB

BIN
module_analysis/static/description/installed_modules_by_types.png

After

Width: 415  |  Height: 238  |  Size: 14 KiB

BIN
module_analysis/static/description/module_authors.png

After

Width: 907  |  Height: 339  |  Size: 25 KiB

BIN
module_analysis/static/description/module_form.png

After

Width: 775  |  Height: 521  |  Size: 39 KiB

BIN
module_analysis/static/description/module_types.png

After

Width: 904  |  Height: 196  |  Size: 15 KiB

15
module_analysis/views/menu.xml

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2019-Today: GRAP (<http://www.grap.coop/>)
@author: Sylvain LE GAL (https://twitter.com/legalsylvain)
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
-->
<odoo>
<menuitem id="menu_module_analysis"
name="Module Analysis"
parent="base.menu_management" sequence="100"
groups="base.group_no_one"/>
</odoo>

20
module_analysis/views/view_base_module_update.xml

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2019-Today: GRAP (<http://www.grap.coop/>)
@author: Sylvain LE GAL (https://twitter.com/legalsylvain)
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
-->
<odoo>
<record id="view_base_module_update_form" model="ir.ui.view">
<field name="model">base.module.update</field>
<field name="inherit_id" ref="base.view_base_module_update"/>
<field name="arch" type="xml">
<xpath expr='//group[@states="init"]' position="inside">
<field name="analyze_installed_modules"/>
</xpath>
</field>
</record>
</odoo>

54
module_analysis/views/view_ir_module_author.xml

@ -0,0 +1,54 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2019-Today: GRAP (<http://www.grap.coop/>)
@author: Sylvain LE GAL (https://twitter.com/legalsylvain)
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
-->
<odoo>
<record id="view_ir_module_author_form" model="ir.ui.view">
<field name="model">ir.module.author</field>
<field name="arch" type="xml">
<form>
<sheet>
<div class="oe_title">
<div class="oe_edit_only"><label for="name"/></div>
<h1><field name="name"/></h1>
</div>
<group>
<field name="installed_module_qty"/>
<field name="module_qty"/>
</group>
</sheet>
</form>
</field>
</record>
<record id="view_ir_module_author_tree" model="ir.ui.view">
<field name="model">ir.module.author</field>
<field name="arch" type="xml">
<tree>
<field name="name"/>
<field name="installed_module_qty"/>
<field name="module_qty"/>
</tree>
</field>
</record>
<record id="action_ir_module_author" model="ir.actions.act_window">
<field name="name">Modules Authors</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">ir.module.author</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
</record>
<menuitem id="menu_module_authors"
parent="menu_module_analysis" sequence="1"
action="action_ir_module_author"
groups="base.group_no_one"/>
</odoo>

58
module_analysis/views/view_ir_module_module.xml

@ -0,0 +1,58 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2019-Today: GRAP (<http://www.grap.coop/>)
@author: Sylvain LE GAL (https://twitter.com/legalsylvain)
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
-->
<odoo>
<record id="view_ir_module_module_form" model="ir.ui.view">
<field name="model">ir.module.module</field>
<field name="inherit_id" ref="base.module_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='state']/.." position="after">
<button name="button_analyze_code" states="installed" string="Refresh Code Analysis" type="object" class="btn btn-primary"/>
<group string="Code Size" col="4">
<field name="python_lines_qty"/>
<field name="xml_lines_qty"/>
<field name="js_lines_qty"/>
<field name="css_lines_qty"/>
</group>
<group string="Type and Authors">
<field name="author_ids" widget="many2many_tags"/>
<field name="module_type_id"/>
</group>
</xpath>
</field>
</record>
<record id="view_ir_module_module_pivot" model="ir.ui.view">
<field name="model">ir.module.module</field>
<field name="arch" type="xml">
<pivot>
<field name="module_type_id" type="row"/>
<field name="python_lines_qty" type="measure"/>
<field name="xml_lines_qty" type="measure"/>
<field name="js_lines_qty" type="measure"/>
<field name="css_lines_qty" type="measure"/>
</pivot>
</field>
</record>
<record id="action_ir_module_module_by_type" model="ir.actions.act_window">
<field name="name">Installed Modules by Types</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">ir.module.module</field>
<field name="domain">[('state', '=', 'installed')]</field>
<field name="view_type">form</field>
<field name="view_mode">pivot</field>
</record>
<menuitem id="menu_module_by_type"
parent="menu_module_analysis" sequence="5"
action="action_ir_module_module_by_type"
groups="base.group_no_one"/>
</odoo>

50
module_analysis/views/view_ir_module_type.xml

@ -0,0 +1,50 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2019-Today: GRAP (<http://www.grap.coop/>)
@author: Sylvain LE GAL (https://twitter.com/legalsylvain)
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
-->
<odoo>
<record id="view_ir_module_type_form" model="ir.ui.view">
<field name="model">ir.module.type</field>
<field name="arch" type="xml">
<form>
<sheet>
<div class="oe_title">
<div class="oe_edit_only"><label for="name"/></div>
<h1><field name="name"/></h1>
</div>
<group>
</group>
</sheet>
</form>
</field>
</record>
<record id="view_ir_module_type_tree" model="ir.ui.view">
<field name="model">ir.module.type</field>
<field name="arch" type="xml">
<tree>
<field name="name"/>
<field name="module_qty"/>
</tree>
</field>
</record>
<record id="action_ir_module_type" model="ir.actions.act_window">
<field name="name">Modules Types</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">ir.module.type</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
</record>
<menuitem id="menu_module_types"
parent="menu_module_analysis" sequence="2"
action="action_ir_module_type"
groups="base.group_no_one"/>
</odoo>

34
module_analysis/views/view_ir_module_type_rule.xml

@ -0,0 +1,34 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2019-Today: GRAP (<http://www.grap.coop/>)
@author: Sylvain LE GAL (https://twitter.com/legalsylvain)
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
-->
<odoo>
<record id="view_ir_module_type_rule_tree" model="ir.ui.view">
<field name="model">ir.module.type.rule</field>
<field name="arch" type="xml">
<tree editable="bottom">
<field name="sequence" widget="handle"/>
<field name="module_type_id"/>
<field name="module_domain"/>
</tree>
</field>
</record>
<record id="action_ir_module_type_rule" model="ir.actions.act_window">
<field name="name">Modules Types Rules</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">ir.module.type.rule</field>
<field name="view_type">form</field>
<field name="view_mode">tree</field>
</record>
<menuitem id="menu_module_type_rules"
parent="menu_module_analysis" sequence="3"
action="action_ir_module_type_rule"
groups="base.group_no_one"/>
</odoo>
Loading…
Cancel
Save