Skip to content

Commit

Permalink
Merge pull request #1691 from OCA/17.0
Browse files Browse the repository at this point in the history
Syncing from upstream OCA/server-tools (17.0)
  • Loading branch information
bt-admin authored Jan 1, 2025
2 parents f540342 + 9ecb5cd commit a7057e4
Show file tree
Hide file tree
Showing 10 changed files with 56 additions and 37 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ addon | version | maintainers | summary
[server_action_logging](server_action_logging/) | 17.0.1.0.0 | | Module that provides a logging mechanism for server actions
[session_db](session_db/) | 17.0.1.0.0 | [![sbidoul](https://github.com/sbidoul.png?size=30px)](https://github.com/sbidoul) | Store sessions in DB
[tracking_manager](tracking_manager/) | 17.0.1.0.7 | [![Kev-Roche](https://github.com/Kev-Roche.png?size=30px)](https://github.com/Kev-Roche) [![sebastienbeau](https://github.com/sebastienbeau.png?size=30px)](https://github.com/sebastienbeau) | This module tracks all fields of a model, including one2many and many2many ones.
[upgrade_analysis](upgrade_analysis/) | 17.0.1.0.1 | [![StefanRijnhart](https://github.com/StefanRijnhart.png?size=30px)](https://github.com/StefanRijnhart) [![legalsylvain](https://github.com/legalsylvain.png?size=30px)](https://github.com/legalsylvain) | Performs a difference analysis between modules installed on two different Odoo instances
[upgrade_analysis](upgrade_analysis/) | 17.0.1.0.2 | [![StefanRijnhart](https://github.com/StefanRijnhart.png?size=30px)](https://github.com/StefanRijnhart) [![legalsylvain](https://github.com/legalsylvain.png?size=30px)](https://github.com/legalsylvain) | Performs a difference analysis between modules installed on two different Odoo instances


Unported addons
Expand Down
26 changes: 13 additions & 13 deletions upgrade_analysis/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Upgrade Analysis
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:06e4beaded7780203b89871f8ebde11988d0b43336a97eaeec324ca429f3fd80
!! source digest: sha256:0eab5b561650419e0df6f886a3a0faa50e7534265f0c7ab1ad742767d423fae5
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
Expand Down Expand Up @@ -54,11 +54,11 @@ Usage
Known issues / Roadmap
======================

- Log removed modules in the module that owned them (#468)
- Detect renamed many2many tables (#213)
- Make sure that the ``migration_analysis.txt`` file is always
generated in all cases. (See:
https://github.com/OCA/OpenUpgrade/pull/3209#issuecomment-1157449981)
- Log removed modules in the module that owned them (#468)
- Detect renamed many2many tables (#213)
- Make sure that the ``migration_analysis.txt`` file is always generated
in all cases. (See:
https://github.com/OCA/OpenUpgrade/pull/3209#issuecomment-1157449981)

Bug Tracker
===========
Expand All @@ -83,13 +83,13 @@ Authors
Contributors
------------

- Stefan Rijnhart <[email protected]>
- Holger Brunn <[email protected]>
- Pedro M. Baeza <[email protected]>
- Ferdinand Gassauer <[email protected]>
- Florent Xicluna <[email protected]>
- Miquel Raïch <[email protected]>
- Sylvain LE GAL <https://twitter.com/legalsylvain>
- Stefan Rijnhart <[email protected]>
- Holger Brunn <[email protected]>
- Pedro M. Baeza <[email protected]>
- Ferdinand Gassauer <[email protected]>
- Florent Xicluna <[email protected]>
- Miquel Raïch <[email protected]>
- Sylvain LE GAL <https://twitter.com/legalsylvain>

Maintainers
-----------
Expand Down
2 changes: 1 addition & 1 deletion upgrade_analysis/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"name": "Upgrade Analysis",
"summary": "Performs a difference analysis between modules"
" installed on two different Odoo instances",
"version": "17.0.1.0.1",
"version": "17.0.1.0.2",
"category": "Migration",
"author": "Therp BV, Opener B.V., GRAP, Odoo Community Association (OCA)",
"maintainers": ["StefanRijnhart", "legalsylvain"],
Expand Down
9 changes: 5 additions & 4 deletions upgrade_analysis/compare.py
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,8 @@ def compare_model_sets(old_records, new_records):
text += f" [{column['model_type']}]"
reprs[module_map(column["module"])].append(text)
reprs["general"].append(
f"obsolete model {model} [module module_map(column['module'])]"
f"obsolete model {model} "
f"[module {module_map(column['module'])}]"
)
else:
moved_module = ""
Expand All @@ -492,7 +493,7 @@ def compare_model_sets(old_records, new_records):
moved_module,
)
if column["model_type"]:
text += " [column['model_type']]"
text += f" [{column['model_type']}]"
reprs[module_map(column["module"])].append(text)
reprs["general"].append(
f"obsolete model {model} (renamed to {model_map(model)}) "
Expand All @@ -502,11 +503,11 @@ def compare_model_sets(old_records, new_records):
if module_map(column["module"]) != new_models[model]:
text = f"model {model} (moved to {new_models[model]})"
if column["model_type"]:
text += " [column['model_type']]"
text += f" [{column['model_type']}]"
reprs[module_map(column["module"])].append(text)
text = f"model {model} (moved from {old_models[model]})"
if column["model_type"]:
text += " [column['model_type']]"
text += f" [{column['model_type']}]"

for column in copy.copy(new_records):
model = column["model"]
Expand Down
18 changes: 15 additions & 3 deletions upgrade_analysis/models/upgrade_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,16 @@ def generate_module_coverage_file(self, no_changes_modules):

module_domain = [
("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()
Expand All @@ -552,16 +561,19 @@ def generate_module_coverage_file(self, no_changes_modules):
module_descriptions = {}
for module in all_modules:
status = ""
is_new = False
if module in all_local_modules and module in all_remote_modules:
module_description = " %s" % module
elif module in all_local_modules:
module_description = " |new| %s" % module
is_new = True
else:
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]
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]
elif module in compare.apriori.renamed_modules.values():
status = (
Expand Down
8 changes: 7 additions & 1 deletion upgrade_analysis/models/upgrade_comparison_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,10 @@ def new_analysis(self):

def action_show_analysis(self):
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)],
}
6 changes: 3 additions & 3 deletions upgrade_analysis/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ <h1 class="title">Upgrade Analysis</h1>
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:06e4beaded7780203b89871f8ebde11988d0b43336a97eaeec324ca429f3fd80
!! source digest: sha256:0eab5b561650419e0df6f886a3a0faa50e7534265f0c7ab1ad742767d423fae5
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/server-tools/tree/17.0/upgrade_analysis"><img alt="OCA/server-tools" src="https://img.shields.io/badge/github-OCA%2Fserver--tools-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/server-tools-17-0/server-tools-17-0-upgrade_analysis"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/server-tools&amp;target_branch=17.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This module provides the tool to generate the database analysis files
Expand Down Expand Up @@ -404,8 +404,8 @@ <h1><a class="toc-backref" href="#toc-entry-2">Known issues / Roadmap</a></h1>
<ul class="simple">
<li>Log removed modules in the module that owned them (#468)</li>
<li>Detect renamed many2many tables (#213)</li>
<li>Make sure that the <tt class="docutils literal">migration_analysis.txt</tt> file is always
generated in all cases. (See:
<li>Make sure that the <tt class="docutils literal">migration_analysis.txt</tt> file is always generated
in all cases. (See:
<a class="reference external" href="https://github.com/OCA/OpenUpgrade/pull/3209#issuecomment-1157449981">https://github.com/OCA/OpenUpgrade/pull/3209#issuecomment-1157449981</a>)</li>
</ul>
</div>
Expand Down
18 changes: 9 additions & 9 deletions upgrade_analysis/tests/test_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class TestUpgradeAnalysis(common.TransactionCase):
def setUp(self):
super().setUp()
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.upgrade_analysis = self.IrModuleModule.search(
[("name", "=", "upgrade_analysis")]
Expand All @@ -20,19 +20,19 @@ def test_upgrade_install_wizard(self):

wizard.select_odoo_modules()
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",
)

wizard.select_oca_modules()
self.assertTrue(
self.upgrade_analysis.id in wizard.module_ids.ids,
"Select OCA module should select 'upgrade_analysis' module",
)
# New patch avoids to reinstall already installed modules, so this will fail
# wizard.select_oca_modules()
# self.assertTrue(
# self.upgrade_analysis.id in wizard.module_ids.ids,
# "Select OCA module should select 'upgrade_analysis' module",
# )

wizard.select_other_modules()
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",
)

Expand Down
2 changes: 1 addition & 1 deletion upgrade_analysis/upgrade_log.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ def log_xml_id(cr, module, xml_id):
if "." not in xml_id:
xml_id = f"{module}.{xml_id}"
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("."),
)
record = cr.fetchone()
Expand Down
2 changes: 1 addition & 1 deletion upgrade_analysis/wizards/upgrade_install_wizard.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class UpgradeInstallWizard(models.TransientModel):
def _module_ids_domain(self, extra_domain=None):
domain = [
"&",
("state", "not in", ["uninstallable", "unknown"]),
("state", "not in", ["installed", "uninstallable", "unknown"]),
("name", "not in", BLACKLIST_MODULES),
]
if extra_domain:
Expand Down

0 comments on commit a7057e4

Please sign in to comment.