From 3bbabf1cf8be13d14f2b3599b29c522778f1fe61 Mon Sep 17 00:00:00 2001 From: AjmalCybro Date: Tue, 29 Jul 2025 15:26:49 +0530 Subject: [PATCH] Jul 29 [UPDT]: Updated 'odoo_health_report/' --- odoo_health_report/README.rst | 2 +- odoo_health_report/__manifest__.py | 6 +- odoo_health_report/doc/RELEASE_NOTES.md | 15 +- .../models/check_odoo_python_guidelines.py | 6 +- odoo_health_report/models/check_violations.py | 17 +- .../models/module_quality_package.py | 3 +- .../reports/ir_actions_report.xml | 4 +- .../reports/odoo_health_report.xml | 622 +++++++++--------- odoo_health_report/requirements.txt | 7 + .../static/description/index.html | 4 +- .../images/icons_report/icon-all-field.svg | 5 + .../images/icons_report/icon-non-stored.svg | 6 + .../images/icons_report/icon-stored.svg | 4 + odoo_health_report/static/src/css/main.css | 69 +- .../static/src/js/module_quality.js | 2 +- .../static/src/xml/health_dashboard.xml | 21 +- .../static/src/xml/module_quality.xml | 254 +++---- 17 files changed, 578 insertions(+), 469 deletions(-) create mode 100644 odoo_health_report/requirements.txt create mode 100644 odoo_health_report/static/src/assets/images/icons_report/icon-all-field.svg create mode 100644 odoo_health_report/static/src/assets/images/icons_report/icon-non-stored.svg create mode 100644 odoo_health_report/static/src/assets/images/icons_report/icon-stored.svg diff --git a/odoo_health_report/README.rst b/odoo_health_report/README.rst index 0e31adacc..09840397d 100644 --- a/odoo_health_report/README.rst +++ b/odoo_health_report/README.rst @@ -2,7 +2,7 @@ :target: https://www.odoo.com/documentation/18.0/legal/licenses.html#odoo-apps :alt: License: OPL-1 -Odoo Health Report +Odoo Module Health Report ================= This module allows you to display Odoo app module details and print them as a PDF report. diff --git a/odoo_health_report/__manifest__.py b/odoo_health_report/__manifest__.py index e2e726d01..aa683417e 100644 --- a/odoo_health_report/__manifest__.py +++ b/odoo_health_report/__manifest__.py @@ -20,8 +20,8 @@ # ###################################################################################### { - 'name': 'Odoo Health Report', - 'version': '18.0.2.1.1', + 'name': 'Odoo Module Health Report', + 'version': '18.0.2.2.1', 'category': 'Productivity', 'summary': "Odoo Module Health Monitoring Tool", 'description': 'Displays odoo apps report in the menu and as a PDF report.', @@ -38,6 +38,7 @@ 'bandit', 'radon', 'pylint', + 'pylint-odoo', 'flake8' ], }, @@ -50,7 +51,6 @@ 'assets': { 'web.assets_backend': [ 'https://cdn.jsdelivr.net/npm/chart.js', - 'https://cdnjs.cloudflare.com/ajax/libs/iconify/2.0.0/iconify.min.js', 'https://fonts.googleapis.com/css2?family=Open+Sans:ital,wght@0,300..800;1,300..800&family=Public+Sans:ital,wght@0,100..900;1,100..900&display=swap.css', 'odoo_health_report/static/src/css/main.css', 'odoo_health_report/static/src/js/module_quality.js', diff --git a/odoo_health_report/doc/RELEASE_NOTES.md b/odoo_health_report/doc/RELEASE_NOTES.md index f2082e50e..d52890868 100644 --- a/odoo_health_report/doc/RELEASE_NOTES.md +++ b/odoo_health_report/doc/RELEASE_NOTES.md @@ -3,9 +3,20 @@ #### 02.07.2025 #### Version 18.0.1.0.1 #### ADD -- Initial Commit for Odoo Health Report +- Initial Commit for Odoo Module Health Report #### 11.07.2025 #### Version 18.0.2.1.1 #### UPDATE -- Added new features \ No newline at end of file +- Added new features + +#### 22.07.2025 +#### Version 18.0.2.2.1 +#### FIX +- Fixed checking violation bug +#### UPDATE +- Removed test folder for checking violations +- Updated styles in dashboard and PDF +- External dependency +#### ADD +- [requirements.txt](../requirements.txt) file diff --git a/odoo_health_report/models/check_odoo_python_guidelines.py b/odoo_health_report/models/check_odoo_python_guidelines.py index 946a2140e..0d3704d3e 100644 --- a/odoo_health_report/models/check_odoo_python_guidelines.py +++ b/odoo_health_report/models/check_odoo_python_guidelines.py @@ -433,8 +433,8 @@ def check_manifest_file(file_path): results.append({ "file": file_path_shorten, "line": version.lineno if hasattr(version, "lineno") else 1, - "issue": f"Version '{version_val}' does not follow '16.0.1.0.0' format", - "suggestion": "Use 5-level semantic versioning like '16.0.1.0.0'" + "issue": f"Version '{version_val}' does not follow '18.0.1.0.0' format", + "suggestion": "Use 5-level semantic versioning like '18.0.1.0.0'" }) # Depends check @@ -684,6 +684,8 @@ def scan_directory(directory): """ for root, _, files in os.walk(directory): for file in files: + if file.startswith("test_"): + continue if file == "__manifest__.py": check_manifest_file(os.path.join(root, file)) if file.endswith(".py") and file not in {"__init__.py", "__manifest__.py"}: diff --git a/odoo_health_report/models/check_violations.py b/odoo_health_report/models/check_violations.py index 6cf4d7e9c..f1c962df4 100644 --- a/odoo_health_report/models/check_violations.py +++ b/odoo_health_report/models/check_violations.py @@ -88,7 +88,7 @@ def check_style_lint(module): Returns: list of dictionaries for the violations with the file name and line number. """ - excluded_files = ['__init__.py', '__manifest__.py', '__pycache__', '*.pyc', '.git'] + excluded_files = ['__init__.py', '__manifest__.py', '__pycache__', '*.pyc', '.git', 'tests'] ignored_violations = ['E501', 'E301', 'E302'] venv_python = sys.executable @@ -131,6 +131,7 @@ def check_code_quality(module): '--load-plugins=pylint_odoo', '-d all', '-e odoolint', + '--ignore=tests', '--ignore-patterns=__init__.py,__manifest__.py', get_module_path(module) ], @@ -182,6 +183,8 @@ def check_maintainability_index(module): rec = rec.split(' - ') if len(rec) >= 2: file_path = f"{module}/{rec[0].split(f'/{module}/')[1]}" + if file_path.startswith(f'{module}/tests/'): + continue mi_list.append({'file': file_path, 'grade': rec[1]}) return mi_list @@ -200,6 +203,7 @@ def check_import_sort(module): '--check-only', '--skip', '__init__.py', '--skip', '__manifest__.py', + '--skip', 'tests', get_module_path(module), ], stdout=subprocess.PIPE, @@ -245,7 +249,7 @@ def check_code_format(module): result = subprocess.run([ sys.executable, '-m', 'black', '--check', - '--exclude', '__init__.py|__manifest__.py', + '--exclude', '__init__.py|__manifest__.py|tests', get_module_path(module), ], stdout=subprocess.PIPE, @@ -287,6 +291,11 @@ def check_code_complexity(module): if result.returncode == 0 and result.stdout: clean_stdout = re.sub(r'\x1b\[[0-9;]*m', '', result.stdout) cc_dict = json.loads(clean_stdout.strip()) + cc_dict = { + k: v for k, v in cc_dict.items() + if '/tests/' not in k + } + return cc_dict return {} @@ -303,8 +312,8 @@ def scan_code_security(module): result = subprocess.run([ sys.executable, '-m', 'bandit', '-r', get_module_path(module), - '-x', '__init__.py,__manifest__.py', - '-f', 'json' + '-x', '__init__.py,__manifest__.py,tests', + '-f', 'json', '--quiet' ], stdout=subprocess.PIPE, stderr=subprocess.PIPE, diff --git a/odoo_health_report/models/module_quality_package.py b/odoo_health_report/models/module_quality_package.py index abb754064..9af0271a5 100644 --- a/odoo_health_report/models/module_quality_package.py +++ b/odoo_health_report/models/module_quality_package.py @@ -128,8 +128,7 @@ class ModuleQuality(models.AbstractModel): is_updated.update_module() for module in get_modules(): - module_path = get_module_path(module) - if 'addons' not in module_path.split(os.sep) and module != 'odoo_health_report': + if module != 'odoo_health_report': module_name = self.env.ref(f'base.module_{module}').display_name module_icon = modules.module.get_module_icon(module) module_and_icon[module] = [module_name, module_icon] diff --git a/odoo_health_report/reports/ir_actions_report.xml b/odoo_health_report/reports/ir_actions_report.xml index a90a86bba..bc10fadad 100644 --- a/odoo_health_report/reports/ir_actions_report.xml +++ b/odoo_health_report/reports/ir_actions_report.xml @@ -17,12 +17,12 @@ - Odoo Health Report + Odoo Module Health Report module.quality.package qweb-pdf odoo_health_report.odoo_health_report odoo_health_report.odoo_health_report - Odoo Health Report + Odoo Module Health Report diff --git a/odoo_health_report/reports/odoo_health_report.xml b/odoo_health_report/reports/odoo_health_report.xml index 5a2bbabc2..ee802152c 100644 --- a/odoo_health_report/reports/odoo_health_report.xml +++ b/odoo_health_report/reports/odoo_health_report.xml @@ -1,15 +1,52 @@ - \ No newline at end of file diff --git a/odoo_health_report/requirements.txt b/odoo_health_report/requirements.txt new file mode 100644 index 000000000..a9366ae61 --- /dev/null +++ b/odoo_health_report/requirements.txt @@ -0,0 +1,7 @@ +isort +black +bandit +radon +pylint +pylint-odoo +flake8 diff --git a/odoo_health_report/static/description/index.html b/odoo_health_report/static/description/index.html index e26d37d31..2a2e82a78 100644 --- a/odoo_health_report/static/description/index.html +++ b/odoo_health_report/static/description/index.html @@ -137,7 +137,7 @@ font-size: 46px; font-weight: 700; line-height: normal; - ">Odoo Health Report + ">Odoo Module Health Report
Odoo Health Report + style="font-size: 40px; font-weight: 700; color: #fff;line-height: 60px; text-transform: capitalize; width: 450px;">Odoo Module Health Report

Are your modules up to standard? diff --git a/odoo_health_report/static/src/assets/images/icons_report/icon-all-field.svg b/odoo_health_report/static/src/assets/images/icons_report/icon-all-field.svg new file mode 100644 index 000000000..bbc41f431 --- /dev/null +++ b/odoo_health_report/static/src/assets/images/icons_report/icon-all-field.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/odoo_health_report/static/src/assets/images/icons_report/icon-non-stored.svg b/odoo_health_report/static/src/assets/images/icons_report/icon-non-stored.svg new file mode 100644 index 000000000..eb5c47d98 --- /dev/null +++ b/odoo_health_report/static/src/assets/images/icons_report/icon-non-stored.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/odoo_health_report/static/src/assets/images/icons_report/icon-stored.svg b/odoo_health_report/static/src/assets/images/icons_report/icon-stored.svg new file mode 100644 index 000000000..6ec6ba2ad --- /dev/null +++ b/odoo_health_report/static/src/assets/images/icons_report/icon-stored.svg @@ -0,0 +1,4 @@ + + + + diff --git a/odoo_health_report/static/src/css/main.css b/odoo_health_report/static/src/css/main.css index 715dd6f54..e94858660 100644 --- a/odoo_health_report/static/src/css/main.css +++ b/odoo_health_report/static/src/css/main.css @@ -988,11 +988,14 @@ margin-top: 10px; border-radius: 12px; border: 1px solid #e5e5e5; + overflow-y: scroll; + max-height: 500px; } .hr-module-table-container-title { color: #000; font-size: 18px; font-weight: 700; + text-transform: capitalize; } .hr-accordion-item { @@ -1002,16 +1005,6 @@ border-radius: 10px; } -.hr-accordion-item div.mt-4 { - max-height: 500px; - overflow-y: scroll; -} - -.hr-accordion-item div.mt-4 h3 { - position: sticky; - top: 0; -} - .hr-accordion-item .hr-accordion-header { width: 100%; border: 1px solid #e5e5e5; @@ -1038,6 +1031,9 @@ .hr-accordion-item .hr-accordion-header:hover { background-color: #f8f8f8; } +.hr-accordion-header.selected { + border: 1px solid #2B7FFF; +} .hr-accordion-item .icon { font-size: 20px; } @@ -1047,6 +1043,9 @@ .hr-accordion-item h4 { margin-bottom: unset; } +.hr-accordion-item h3.mt-4 { + font-weight: 700; +} .hr-accordion-item .hr-accordion-content { display: none; background-color: #fff; @@ -1418,7 +1417,12 @@ button.hrl-secondary-button:active { font-style: normal; font-weight: 700; } - +.hr-modal_dialog { + width: 450px; +} +.hr-modal_dialog .modal-content { + border-radius: 12px; +} .hr-modal .modal-header { border-bottom: none; padding: 24px !important; @@ -1444,6 +1448,9 @@ button.hrl-secondary-button:active { width: 24px; height: 24px; } +.hr-modal-body .hr-form_input:checked { + background-color: #007bff; +} .hr-modal-body .hr-form_input:focus { -webkit-box-shadow: none !important; box-shadow: none !important; @@ -2342,6 +2349,7 @@ button.hrl-secondary-button:active { .scrollbar { /* Scrollbar Styling */ + scrollbar-color: #2B7FFF; } .scrollbar ::-webkit-scrollbar { width: 7px; @@ -2354,6 +2362,17 @@ button.hrl-secondary-button:active { border-radius: 10px; background: #bababa; } +.scrollbar.hr-module-table-container::-webkit-scrollbar { + width: 5px; +} +.scrollbar.hr-module-table-container::-webkit-scrollbar-track { + background: #E4E4E4; + border-radius: 10px; +} +.scrollbar.hr-module-table-container::-webkit-scrollbar-thumb { + background: #2B7FFF; + border-radius: 10px; +} .table-container { width: 100%; @@ -2363,8 +2382,7 @@ button.hrl-secondary-button:active { -webkit-box-pack: center; -ms-flex-pack: center; justify-content: center; - overflow-y: scroll; - max-height: 500px; + margin-top: 16px; } table { @@ -2373,14 +2391,13 @@ table { text-align: left; } table thead { - background-color: #d0e97b; - position: sticky; - top: 0px; + color: black; } table thead th { padding: 12px; - border-bottom: 2px solid #ddd; font-size: 16px; + background-color: #DDF66B; + } table thead th:first-child { border-top-left-radius: 10px; @@ -2392,12 +2409,9 @@ table .error { color: #ff0000; } table tbody tr { - border-left: 1px solid #ddd; - border-right: 1px solid #ddd; font-size: 14px; -} -table tbody tr { border-bottom: 1px solid #ddd; + box-shadow: inset 1px 0 0 #ddd, inset -1px 0 0 #ddd; } table tbody tr:hover { background-color: #f9f9f9; @@ -2523,3 +2537,16 @@ table tbody tr td { .text-orange { color: #fd7e14; } .text-dark-red { color: #8B0000; } + +.animated-checkbox { + transition: background-color 0.3s ease, border-color 0.3s ease; +} + +.animated-checkbox::after { + transform: scale(0) rotate(45deg); + transition: transform 0.2s ease; +} + +.animated-checkbox:checked::after { + transform: scale(1) rotate(45deg); +} diff --git a/odoo_health_report/static/src/js/module_quality.js b/odoo_health_report/static/src/js/module_quality.js index 0e53bb7e0..228231da2 100644 --- a/odoo_health_report/static/src/js/module_quality.js +++ b/odoo_health_report/static/src/js/module_quality.js @@ -25,6 +25,7 @@ export class ModuleQuality extends Component { all_modules : {}, loading_accordian: false, expanded_accordian: false, + selectedModule: false, }); this.orm = useService("orm"); @@ -94,7 +95,6 @@ export class ModuleQuality extends Component { } displayViolations(name) { - // If clicking the same module again, toggle the table visibility if (this.state.selectedModule === name) { this.state.selectedModule = null; this.state.module_selected = null; diff --git a/odoo_health_report/static/src/xml/health_dashboard.xml b/odoo_health_report/static/src/xml/health_dashboard.xml index 17a11622c..364bc4821 100644 --- a/odoo_health_report/static/src/xml/health_dashboard.xml +++ b/odoo_health_report/static/src/xml/health_dashboard.xml @@ -68,7 +68,7 @@