Merge PR #3144 into 17.0

Signed-off-by legalsylvain
pull/3187/head
OCA-git-bot 2024-12-31 20:21:04 +00:00
commit c93b86c215
8 changed files with 45 additions and 29 deletions

View File

@ -35,7 +35,7 @@ modules are included in the OpenUpgrade distribution so as a migration
script developer you will not usually need to use this tool yourself. If script developer you will not usually need to use this tool yourself. If
you do need to run your analysis of a custom set of modules, please you do need to run your analysis of a custom set of modules, please
refer to the documentation here: refer to the documentation here:
https://doc.therp.nl/openupgrade/analysis.html <https://doc.therp.nl/openupgrade/analysis.html>
This module is just a tool, a continuation of the old This module is just a tool, a continuation of the old
openupgrade_records in OpenUpgrade in previous versions. It's not openupgrade_records in OpenUpgrade in previous versions. It's not

View File

@ -480,7 +480,8 @@ def compare_model_sets(old_records, new_records):
text += f" [{column['model_type']}]" text += f" [{column['model_type']}]"
reprs[module_map(column["module"])].append(text) reprs[module_map(column["module"])].append(text)
reprs["general"].append( reprs["general"].append(
f"obsolete model {model} [module module_map(column['module'])]" f"obsolete model {model} "
f"[module {module_map(column['module'])}]"
) )
else: else:
moved_module = "" moved_module = ""
@ -492,7 +493,7 @@ def compare_model_sets(old_records, new_records):
moved_module, moved_module,
) )
if column["model_type"]: if column["model_type"]:
text += " [column['model_type']]" text += f" [{column['model_type']}]"
reprs[module_map(column["module"])].append(text) reprs[module_map(column["module"])].append(text)
reprs["general"].append( reprs["general"].append(
f"obsolete model {model} (renamed to {model_map(model)}) " f"obsolete model {model} (renamed to {model_map(model)}) "
@ -502,11 +503,11 @@ def compare_model_sets(old_records, new_records):
if module_map(column["module"]) != new_models[model]: if module_map(column["module"]) != new_models[model]:
text = f"model {model} (moved to {new_models[model]})" text = f"model {model} (moved to {new_models[model]})"
if column["model_type"]: if column["model_type"]:
text += " [column['model_type']]" text += f" [{column['model_type']}]"
reprs[module_map(column["module"])].append(text) reprs[module_map(column["module"])].append(text)
text = f"model {model} (moved from {old_models[model]})" text = f"model {model} (moved from {old_models[model]})"
if column["model_type"]: if column["model_type"]:
text += " [column['model_type']]" text += f" [{column['model_type']}]"
for column in copy.copy(new_records): for column in copy.copy(new_records):
model = column["model"] model = column["model"]

View File

@ -532,7 +532,16 @@ class UpgradeAnalysis(models.Model):
module_domain = [ module_domain = [
("state", "=", "installed"), ("state", "=", "installed"),
("name", "not in", ["upgrade_analysis", "openupgrade_records"]), (
"name",
"not in",
[
"upgrade_analysis",
"openupgrade_records",
"openupgrade_scripts",
"openupgrade_framework",
],
),
] ]
connection = self.config_id.get_connection() connection = self.config_id.get_connection()
@ -552,16 +561,19 @@ class UpgradeAnalysis(models.Model):
module_descriptions = {} module_descriptions = {}
for module in all_modules: for module in all_modules:
status = "" status = ""
is_new = False
if module in all_local_modules and module in all_remote_modules: if module in all_local_modules and module in all_remote_modules:
module_description = " %s" % module module_description = " %s" % module
elif module in all_local_modules: elif module in all_local_modules:
module_description = " |new| %s" % module module_description = " |new| %s" % module
is_new = True
else: else:
module_description = " |del| %s" % module module_description = " |del| %s" % module
if module in compare.apriori.merged_modules: # new modules cannot be merged/renamed in same version
if not is_new and module in compare.apriori.merged_modules:
status = "Merged into %s. " % compare.apriori.merged_modules[module] status = "Merged into %s. " % compare.apriori.merged_modules[module]
elif module in compare.apriori.renamed_modules: elif not is_new and module in compare.apriori.renamed_modules:
status = "Renamed to %s. " % compare.apriori.renamed_modules[module] status = "Renamed to %s. " % compare.apriori.renamed_modules[module]
elif module in compare.apriori.renamed_modules.values(): elif module in compare.apriori.renamed_modules.values():
status = ( status = (

View File

@ -93,4 +93,10 @@ class UpgradeComparisonConfig(models.Model):
def action_show_analysis(self): def action_show_analysis(self):
self.ensure_one() self.ensure_one()
return {} return {
"type": "ir.actions.act_window",
"name": "Analyses",
"res_model": "upgrade.analysis",
"view_mode": "tree,form",
"domain": [("id", "in", self.analysis_ids.ids)],
}

View File

@ -8,11 +8,10 @@
/* /*
:Author: David Goodger (goodger@python.org) :Author: David Goodger (goodger@python.org)
:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $ :Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $
:Copyright: This stylesheet has been placed in the public domain. :Copyright: This stylesheet has been placed in the public domain.
Default cascading style sheet for the HTML output of Docutils. Default cascading style sheet for the HTML output of Docutils.
Despite the name, some widely supported CSS2 features are used.
See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
customize this style sheet. customize this style sheet.
@ -275,7 +274,7 @@ pre.literal-block, pre.doctest-block, pre.math, pre.code {
margin-left: 2em ; margin-left: 2em ;
margin-right: 2em } margin-right: 2em }
pre.code .ln { color: gray; } /* line numbers */ pre.code .ln { color: grey; } /* line numbers */
pre.code, code { background-color: #eeeeee } pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 } pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold } pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
@ -301,7 +300,7 @@ span.option {
span.pre { span.pre {
white-space: pre } white-space: pre }
span.problematic, pre.problematic { span.problematic {
color: red } color: red }
span.section-subtitle { span.section-subtitle {
@ -442,9 +441,7 @@ If you spotted it first, help us to smash it by providing a detailed and welcome
<div class="section" id="maintainers"> <div class="section" id="maintainers">
<h2><a class="toc-backref" href="#toc-entry-7">Maintainers</a></h2> <h2><a class="toc-backref" href="#toc-entry-7">Maintainers</a></h2>
<p>This module is maintained by the OCA.</p> <p>This module is maintained by the OCA.</p>
<a class="reference external image-reference" href="https://odoo-community.org"> <a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
</a>
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose <p>OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and mission is to support the collaborative development of Odoo features and
promote its widespread use.</p> promote its widespread use.</p>

View File

@ -8,7 +8,7 @@ class TestUpgradeAnalysis(common.TransactionCase):
def setUp(self): def setUp(self):
super().setUp() super().setUp()
self.IrModuleModule = self.env["ir.module.module"] self.IrModuleModule = self.env["ir.module.module"]
self.product_module = self.IrModuleModule.search([("name", "=", "product")]) self.website_module = self.IrModuleModule.search([("name", "=", "website")])
self.sale_module = self.IrModuleModule.search([("name", "=", "sale")]) self.sale_module = self.IrModuleModule.search([("name", "=", "sale")])
self.upgrade_analysis = self.IrModuleModule.search( self.upgrade_analysis = self.IrModuleModule.search(
[("name", "=", "upgrade_analysis")] [("name", "=", "upgrade_analysis")]
@ -20,19 +20,19 @@ class TestUpgradeAnalysis(common.TransactionCase):
wizard.select_odoo_modules() wizard.select_odoo_modules()
self.assertTrue( self.assertTrue(
self.product_module.id in wizard.module_ids.ids, self.website_module.id in wizard.module_ids.ids,
"Select Odoo module should select 'product' module", "Select Odoo module should select 'product' module",
) )
# New patch avoids to reinstall already installed modules, so this will fail
wizard.select_oca_modules() # wizard.select_oca_modules()
self.assertTrue( # self.assertTrue(
self.upgrade_analysis.id in wizard.module_ids.ids, # self.upgrade_analysis.id in wizard.module_ids.ids,
"Select OCA module should select 'upgrade_analysis' module", # "Select OCA module should select 'upgrade_analysis' module",
) # )
wizard.select_other_modules() wizard.select_other_modules()
self.assertFalse( self.assertFalse(
self.product_module.id in wizard.module_ids.ids, self.website_module.id in wizard.module_ids.ids,
"Select Other module should not select 'product' module", "Select Other module should not select 'product' module",
) )

View File

@ -213,7 +213,7 @@ def log_xml_id(cr, module, xml_id):
if "." not in xml_id: if "." not in xml_id:
xml_id = f"{module}.{xml_id}" xml_id = f"{module}.{xml_id}"
cr.execute( cr.execute(
"SELECT model FROM ir_model_data " "WHERE module = %s AND name = %s", "SELECT model FROM ir_model_data WHERE module = %s AND name = %s",
xml_id.split("."), xml_id.split("."),
) )
record = cr.fetchone() record = cr.fetchone()

View File

@ -35,7 +35,7 @@ class UpgradeInstallWizard(models.TransientModel):
def _module_ids_domain(self, extra_domain=None): def _module_ids_domain(self, extra_domain=None):
domain = [ domain = [
"&", "&",
("state", "not in", ["uninstallable", "unknown"]), ("state", "not in", ["installed", "uninstallable", "unknown"]),
("name", "not in", BLACKLIST_MODULES), ("name", "not in", BLACKLIST_MODULES),
] ]
if extra_domain: if extra_domain: