diff --git a/upgrade_analysis/__manifest__.py b/upgrade_analysis/__manifest__.py index c3d5e6f1b..d07930884 100644 --- a/upgrade_analysis/__manifest__.py +++ b/upgrade_analysis/__manifest__.py @@ -5,7 +5,7 @@ "name": "Upgrade Analysis", "summary": "Performs a difference analysis between modules" " installed on two different Odoo instances", - "version": "14.0.2.1.1", + "version": "15.0.1.0.1", "category": "Migration", "author": "Therp BV, Opener B.V., GRAP, Odoo Community Association (OCA)", "website": "https://github.com/OCA/server-tools", diff --git a/upgrade_analysis/migrations/14.0.1.0.0/pre-migrate.py b/upgrade_analysis/migrations/14.0.1.0.0/pre-migrate.py deleted file mode 100644 index ee9409ec4..000000000 --- a/upgrade_analysis/migrations/14.0.1.0.0/pre-migrate.py +++ /dev/null @@ -1,27 +0,0 @@ -# Copyright 2021 ForgeFlow S.L. (https://www.forgeflow.com) -# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -from openupgradelib import openupgrade - -_model_renames = [ - ("openupgrade.analysis.wizard", "upgrade.analysis"), - ("openupgrade.attribute", "upgrade.attribute"), - ("openupgrade.comparison.config", "upgrade.comparison.config"), - ("openupgrade.record", "upgrade.record"), - ("openupgrade.generate.records.wizard", "upgrade.generate.record.wizard"), - ("openupgrade.install.all.wizard", "upgrade.install.wizard"), -] - -_table_renames = [ - ("openupgrade_analysis_wizard", "upgrade_analysis"), - ("openupgrade_attribute", "upgrade_attribute"), - ("openupgrade_comparison_config", "upgrade_comparison_config"), - ("openupgrade_record", "upgrade_record"), - ("openupgrade_generate_records_wizard", "upgrade_generate_record_wizard"), - ("openupgrade_install_all_wizard", "upgrade_install_wizard"), -] - - -@openupgrade.migrate() -def migrate(env, version): - openupgrade.rename_models(env.cr, _model_renames) - openupgrade.rename_tables(env.cr, _table_renames) diff --git a/upgrade_analysis/models/upgrade_analysis.py b/upgrade_analysis/models/upgrade_analysis.py index 932ce80f0..2a6046e54 100644 --- a/upgrade_analysis/models/upgrade_analysis.py +++ b/upgrade_analysis/models/upgrade_analysis.py @@ -429,10 +429,8 @@ class UpgradeAnalysis(models.Model): root_node_noupdate = nodeattr2bool(root_node, "noupdate", False) if root_node.tag not in ("openerp", "odoo", "data"): raise ValidationError( - _( - "Unexpected root Element: %s in file: %s" - % (root_node.getroot(), xml_file) - ) + _("Unexpected root Element: %(root)s in file: %(file)s") + % {"root": root_node.getroot(), "file": xml_file} ) for node in root_node: if node.tag == "data": diff --git a/upgrade_analysis/models/upgrade_comparison_config.py b/upgrade_analysis/models/upgrade_comparison_config.py index 35fcd5005..649866379 100644 --- a/upgrade_analysis/models/upgrade_comparison_config.py +++ b/upgrade_analysis/models/upgrade_comparison_config.py @@ -43,11 +43,11 @@ class UpgradeComparisonConfig(models.Model): self.ensure_one() try: remote = odoorpc.ODOO(self.server, port=self.port) - except URLError: + except URLError as exc: raise UserError( - _("Could not connect the Odoo server at %s:%s") - % (self.server, self.port) - ) + _("Could not connect the Odoo server at %(server)s:%(port)s") + % {"server": self.server, "port": self.port} + ) from exc remote.login(self.database, self.username, self.password) self.version = remote.version return remote @@ -60,7 +60,7 @@ class UpgradeComparisonConfig(models.Model): ids = user_model.search([("login", "=", "admin")]) user_info = user_model.read([ids[0]], ["name"])[0] except Exception as e: - raise UserError(_("Connection failed.\n\nDETAIL: %s") % e) + raise UserError(_("Connection failed.\n\nDETAIL: %s") % e) from e return { "type": "ir.actions.client", "tag": "display_notification", diff --git a/upgrade_analysis/models/upgrade_record.py b/upgrade_analysis/models/upgrade_record.py index f62c7ca3e..2f0db3827 100644 --- a/upgrade_analysis/models/upgrade_record.py +++ b/upgrade_analysis/models/upgrade_record.py @@ -138,7 +138,7 @@ class UpgradeRecord(models.Model): @api.model def list_modules(self): - """ Return the set of covered modules """ + """Return the set of covered modules""" self.env.cr.execute( """SELECT DISTINCT(module) FROM upgrade_record ORDER BY module""" @@ -152,11 +152,13 @@ class UpgradeRecord(models.Model): with open(os.path.join(addon_dir, manifest_name), "r") as f: manifest_string = f.read() return ast.literal_eval(manifest_string) - raise ValidationError(_("No manifest found in %s" % addon_dir)) + raise ValidationError( + _("No manifest found in %(addon_dir)s") % {"addon_dir": addon_dir} + ) @api.model def get_xml_records(self, module): - """ Return all XML records from the given module """ + """Return all XML records from the given module""" addon_dir = get_module_path(module) manifest = self._read_manifest(addon_dir) # The order of the keys are important. diff --git a/upgrade_analysis/odoo_patch/addons/mrp/__init__.py b/upgrade_analysis/odoo_patch/addons/mrp/__init__.py index 09caee64c..e795cbc33 100644 --- a/upgrade_analysis/odoo_patch/addons/mrp/__init__.py +++ b/upgrade_analysis/odoo_patch/addons/mrp/__init__.py @@ -8,4 +8,4 @@ class PreInitHookPatch(OdooPatch): method_names = ["_pre_init_mrp"] def _pre_init_mrp(cr): - """ Don't try to create an existing column on reinstall """ + """Don't try to create an existing column on reinstall""" diff --git a/upgrade_analysis/odoo_patch/addons/point_of_sale/__init__.py b/upgrade_analysis/odoo_patch/addons/point_of_sale/__init__.py index 66f003c17..f363b8106 100644 --- a/upgrade_analysis/odoo_patch/addons/point_of_sale/__init__.py +++ b/upgrade_analysis/odoo_patch/addons/point_of_sale/__init__.py @@ -10,4 +10,4 @@ class PreInitHookPatch(OdooPatch): @api.model def post_install_pos_localisation(cr): - """ Do not configure twice pos_localisation""" + """Do not configure twice pos_localisation""" diff --git a/upgrade_analysis/odoo_patch/addons/stock/__init__.py b/upgrade_analysis/odoo_patch/addons/stock/__init__.py index 206795b42..3ff1cb0a2 100644 --- a/upgrade_analysis/odoo_patch/addons/stock/__init__.py +++ b/upgrade_analysis/odoo_patch/addons/stock/__init__.py @@ -8,4 +8,4 @@ class PreInitHookPatch(OdooPatch): method_names = ["pre_init_hook"] def pre_init_hook(cr): - """ Don't unlink stock data on reinstall """ + """Don't unlink stock data on reinstall""" diff --git a/upgrade_analysis/odoo_patch/odoo/models.py b/upgrade_analysis/odoo_patch/odoo/models.py index 431fc9635..51de8037b 100644 --- a/upgrade_analysis/odoo_patch/odoo/models.py +++ b/upgrade_analysis/odoo_patch/odoo/models.py @@ -10,7 +10,7 @@ class BaseModelPatch(OdooPatch): @api.model def _convert_records(self, records, log=lambda a: None): - """ Log data ids that are imported with `load` """ + """Log data ids that are imported with `load`""" current_module = self.env.context["module"] for res in BaseModelPatch._convert_records._original_method( self, records, log=log diff --git a/upgrade_analysis/upgrade_log.py b/upgrade_analysis/upgrade_log.py index b102d3afa..3a8d13127 100644 --- a/upgrade_analysis/upgrade_log.py +++ b/upgrade_analysis/upgrade_log.py @@ -141,7 +141,7 @@ def log_model(model, local_registry): } if v.type == "selection": if isinstance(v.selection, (tuple, list)): - properties["selection_keys"] = str(sorted([x[0] for x in v.selection])) + properties["selection_keys"] = str(sorted(x[0] for x in v.selection)) else: properties["selection_keys"] = "function" elif v.type == "binary":