From c66789dc71cd8f282d013d67b2c4321873527a68 Mon Sep 17 00:00:00 2001 From: Sylvain LE GAL Date: Thu, 30 Jan 2025 16:04:19 +0100 Subject: [PATCH 1/2] [FIX] template: correct indentation --- .../templates/analysis.html.j2 | 181 ++++++++++-------- .../tools/tools_odoo_module.py | 17 +- 2 files changed, 108 insertions(+), 90 deletions(-) diff --git a/odoo_openupgrade_wizard/templates/analysis.html.j2 b/odoo_openupgrade_wizard/templates/analysis.html.j2 index 1f2b837..d144229 100644 --- a/odoo_openupgrade_wizard/templates/analysis.html.j2 +++ b/odoo_openupgrade_wizard/templates/analysis.html.j2 @@ -1,4 +1,23 @@ + + +

Migration Analysis

@@ -18,6 +37,14 @@ + + + + +
{{ current_date }}
+ Show All Modules + Hide Done Modules +

Summary

@@ -33,29 +60,31 @@ Odoo {{ analysis.get_module_qty('odoo') }} - {{ analysis.workload_hour_text('odoo') }} + {{ time_to_text(analysis.workload('odoo', False)) }} OCA {{ analysis.get_module_qty('oca') }} - {{ analysis.workload_hour_text('oca') }} + {{ time_to_text(analysis.workload('oca', False)) }} Custom {{ analysis.get_module_qty('custom') }} - {{ analysis.workload_hour_text('custom') }} + {{ time_to_text(analysis.workload('custom', False)) }} +{%- if analysis.get_module_qty('not_found') -%} Not Found {{ analysis.get_module_qty('not_found') }}   +{%- endif -%} Total {{ analysis.get_module_qty() }} - {{ analysis.workload_hour_text() }} + {{ time_to_text(analysis.workload(False, False)) }} @@ -66,116 +95,100 @@   Total -{%- for odoo_version in ctx.obj['config']['odoo_versions'] -%} +{%- for odoo_version in ctx.obj['config']['odoo_versions'] %} {{ odoo_version }} -{% endfor %} - +{%- endfor %} + -{% set ns = namespace( - current_repository='', - current_module_type='', -) %} -{% for odoo_module in analysis.modules %} +{%- set ns = namespace(current_repository='', current_module_type='') %} - - - +{%- for odoo_module in analysis.modules %} + {%- if (ns.current_module_type != odoo_module.module_type) %} + {%- set ns.current_module_type = odoo_module.module_type %} - {% if ( - ns.current_module_type != odoo_module.module_type - and odoo_module.module_type != 'odoo') %} - {% set ns.current_module_type = odoo_module.module_type %} + + + - {{ ns.current_module_type}} +

{{ odoo_module.module_type}}

- {% endif %} + {%- endif %} - - - + {%- if ns.current_repository != odoo_module.repository %} + {%- set ns.current_repository = odoo_module.repository %} + {%- set repository_workload = analysis.workload(False, odoo_module.repository) %} - {% if ns.current_repository != odoo_module.repository %} - {% set ns.current_repository = odoo_module.repository %} + + + - {% if ns.current_repository %} - + {%- if ns.current_repository %} + - {{ ns.current_repository}} +

{{ odoo_module.repository}} + {% if repository_workload %} + ({{ time_to_text(repository_workload) }}) + {% endif %} +

- {% endif %} - {% endif %} + {%- endif %} + {%- endif %} - - - - - + {{odoo_module.name}} - {% if odoo_module.module_type == 'not_found' %} - {% set odoo_apps_url = odoo_module.get_odoo_apps_url() %} - {% if odoo_apps_url %} - AppsStore - {% else %} - {% set odoo_code_search_url = odoo_module.get_odoo_code_search_url() %} - {% if odoo_code_search_url %} - - OdooCodeSearch - - {% endif %} - {% endif %} - {% endif %} - + {%- if odoo_module.module_type == 'not_found' -%} + {%- set odoo_apps_url = odoo_module.get_odoo_apps_url() -%} + {%- if odoo_apps_url -%} + AppsStore + {%- else -%} + {%- set odoo_code_search_url = odoo_module.get_odoo_code_search_url() -%} + {%- if odoo_code_search_url -%} + OdooCodeSearch + {%- endif -%} + {%- endif -%} + {%- endif -%} - - {% if odoo_module.workload %} + {%- if odoo_module.workload -%} {{time_to_text(odoo_module.workload)}} - {% endif %} + {%- endif -%} - {% for version in odoo_module.analyse.all_versions %} - {% set module_version = odoo_module.get_module_version(version) %} - {% if module_version %} - {% set size_text = module_version.get_size_text() %} - {% set analysis_text = module_version.get_analysis_text() %} - {% set workload = module_version.workload %} + {%- for version in odoo_module.analyse.all_versions %} + {%- set module_version = odoo_module.get_module_version(version) %} + {%- if module_version %} + {%- set size_text = module_version.get_size_text() %} + {%- set analysis_text = module_version.get_analysis_text() %} + {%- set workload = module_version.workload %} {{module_version.get_text()}} - {% if workload %} - - ({{time_to_text(workload)}}) - - {% endif %} - {% if size_text %} -
- - ({{ size_text}}) - - {% endif %} - {% if analysis_text %} -
- - - ({{ analysis_text}}) - - - {% endif %} - + {%- if workload -%} + ({{time_to_text(workload)}}) + {%- endif -%} + {%- if size_text -%} +
+ ({{ size_text}}) + {%- endif -%} + {%- if analysis_text -%} +
+ + ({{ analysis_text}}) + + {%- endif %} - {% else %} + {%- else %}   - {% endif %} - {% endfor %} + {%- endif %} + {%- endfor %} - -{% endfor %} +{%- endfor %} diff --git a/odoo_openupgrade_wizard/tools/tools_odoo_module.py b/odoo_openupgrade_wizard/tools/tools_odoo_module.py index d1bb68f..87e62bb 100644 --- a/odoo_openupgrade_wizard/tools/tools_odoo_module.py +++ b/odoo_openupgrade_wizard/tools/tools_odoo_module.py @@ -291,22 +291,27 @@ class Analysis(object): odoo_modules = self.modules return len(odoo_modules) - def workload_hour_text(self, module_type=False): + def workload(self, module_type, repository): + odoo_modules = self.modules if module_type: odoo_modules = [ x for x in filter( - lambda x: x.module_type == module_type, self.modules + lambda x: x.module_type == module_type, odoo_modules + ) + ] + if repository: + odoo_modules = [ + x + for x in filter( + lambda x: x.repository == repository, odoo_modules ) ] - else: - odoo_modules = self.modules - total = 0 for odoo_module in odoo_modules: for module_version in list(odoo_module.module_versions.values()): total += module_version.workload - return "%d h" % (int(round(total / 60))) + return total @total_ordering From 2abf4ee896719e00d3450dd9b1a8874d070e4b75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Taymans?= Date: Fri, 31 Jan 2025 16:06:00 +0100 Subject: [PATCH 2/2] [ADD] Newsfragments --- newsfragments/+improving-workload-analysis-file.feature | 1 + 1 file changed, 1 insertion(+) create mode 100644 newsfragments/+improving-workload-analysis-file.feature diff --git a/newsfragments/+improving-workload-analysis-file.feature b/newsfragments/+improving-workload-analysis-file.feature new file mode 100644 index 0000000..0c73d32 --- /dev/null +++ b/newsfragments/+improving-workload-analysis-file.feature @@ -0,0 +1 @@ +Improve workload analysis file with button to hide done module.