From a4ec051384a16ff124c99c95c5a679d60018e1dc Mon Sep 17 00:00:00 2001 From: Sylvain LE GAL Date: Sat, 7 Nov 2020 15:52:29 +0100 Subject: [PATCH] [REF] rename framework files, adapt to new module names, remove print (replaced by logger), apply pre-commit rules --- upgrade_analysis/__init__.py | 2 + upgrade_analysis/__manifest__.py | 2 +- upgrade_analysis/models/__init__.py | 1 + .../upgrade_analysis.py} | 158 +++++++++++------- .../models/upgrade_comparison_config.py | 81 +++++---- upgrade_analysis/odoo_patch/__init__.py | 1 - .../odoo_patch/addons/mrp/__init__.py | 1 - upgrade_analysis/odoo_patch/odoo/models.py | 4 +- .../odoo_patch/odoo/modules/loading.py | 8 +- .../odoo_patch/odoo/tools/convert.py | 2 +- upgrade_analysis/security/ir.model.access.csv | 2 +- ...nupgrade_loading.py => upgrade_loading.py} | 24 ++- .../{openupgrade_log.py => upgrade_log.py} | 31 ++-- .../views/view_upgrade_analysis.xml | 71 ++++++++ .../views/view_upgrade_comparison_config.xml | 75 +++++---- .../views/view_upgrade_record.xml | 50 +++--- upgrade_analysis/wizards/__init__.py | 1 - .../wizards/upgrade_generate_record_wizard.py | 53 +++--- .../wizards/view_upgrade_analysis_wizard.xml | 35 ---- .../view_upgrade_generate_record_wizard.xml | 12 +- .../wizards/view_upgrade_install_wizard.xml | 19 ++- 21 files changed, 355 insertions(+), 278 deletions(-) rename upgrade_analysis/{wizards/upgrade_analysis_wizard.py => models/upgrade_analysis.py} (51%) rename upgrade_analysis/{openupgrade_loading.py => upgrade_loading.py} (94%) rename upgrade_analysis/{openupgrade_log.py => upgrade_log.py} (74%) create mode 100644 upgrade_analysis/views/view_upgrade_analysis.xml delete mode 100644 upgrade_analysis/wizards/view_upgrade_analysis_wizard.xml diff --git a/upgrade_analysis/__init__.py b/upgrade_analysis/__init__.py index 338ffe995..7fc3dd81d 100644 --- a/upgrade_analysis/__init__.py +++ b/upgrade_analysis/__init__.py @@ -4,3 +4,5 @@ from . import wizards from . import blacklist from . import apriori from . import compare +from . import upgrade_loading +from . import upgrade_log diff --git a/upgrade_analysis/__manifest__.py b/upgrade_analysis/__manifest__.py index 1a83113a1..a7d9de82b 100644 --- a/upgrade_analysis/__manifest__.py +++ b/upgrade_analysis/__manifest__.py @@ -13,8 +13,8 @@ "security/ir.model.access.csv", "views/menu.xml", "views/view_upgrade_comparison_config.xml", + "views/view_upgrade_analysis.xml", "views/view_upgrade_record.xml", - "wizards/view_upgrade_analysis_wizard.xml", "wizards/view_upgrade_generate_record_wizard.xml", "wizards/view_upgrade_install_wizard.xml", ], diff --git a/upgrade_analysis/models/__init__.py b/upgrade_analysis/models/__init__.py index e0245a184..7a9c9233d 100644 --- a/upgrade_analysis/models/__init__.py +++ b/upgrade_analysis/models/__init__.py @@ -1,4 +1,5 @@ from . import ir_module_module from . import upgrade_comparison_config +from . import upgrade_analysis from . import upgrade_attribute from . import upgrade_record diff --git a/upgrade_analysis/wizards/upgrade_analysis_wizard.py b/upgrade_analysis/models/upgrade_analysis.py similarity index 51% rename from upgrade_analysis/wizards/upgrade_analysis_wizard.py rename to upgrade_analysis/models/upgrade_analysis.py index 82cbaab77..a579696fa 100644 --- a/upgrade_analysis/wizards/upgrade_analysis_wizard.py +++ b/upgrade_analysis/models/upgrade_analysis.py @@ -7,59 +7,94 @@ import os from odoo import fields, models from odoo.modules import get_module_path +from odoo.tools import config from .. import compare +_IGNORE_MODULES = ["openupgrade_records", "upgrade_analysis"] -class UpgradeAnalysisWizard(models.TransientModel): - _name = "upgrade.analysis.wizard" - _description = "upgrade Analysis Wizard" - server_config_id = fields.Many2one( - "upgrade.comparison.config", "Configuration", required=True - ) +class UpgradeAnalysis(models.Model): + _name = "upgrade.analysis" + _description = "Upgrade Analyses" + + analysis_date = fields.Datetime(readonly=True) + state = fields.Selection( - [("init", "Init"), ("ready", "Ready")], readonly=True, default="init" + [("draft", "draft"), ("done", "Done")], readonly=True, default="draft" ) - log = fields.Text() + config_id = fields.Many2one( + string="Comparison Config", + comodel_name="upgrade.comparison.config", + readonly=True, + required=True, + ) + + log = fields.Text(readonly=True) + write_files = fields.Boolean( help="Write analysis files to the module directories", default=True ) - def get_communication(self): + def _get_remote_model(self, connection, model): + self.ensure_one() + if model == "record": + if float(self.config_id.version) < 14: + return connection.env["openupgrade.record"] + else: + return connection.env["upgrade.record"] + return False + + def _write_file( + self, module_name, version, content, filename="upgrade_analysis.txt" + ): + module = self.env["ir.module.module"].search([("name", "=", module_name)])[0] + if module.is_odoo_module: + upgrade_path = config.get("upgrade_path", False) + if not upgrade_path: + return "ERROR: could not find 'upgrade_path' config:\n" + module_path = os.path.join(upgrade_path, module_name) + else: + module_path = get_module_path(module_name) + if not module_path: + return "ERROR: could not find module path of '%s':\n" % (module_name) + full_path = os.path.join(module_path, "migrations", version) + if not os.path.exists(full_path): + try: + os.makedirs(full_path) + except os.error: + return "ERROR: could not create migrations directory %s:\n" % ( + full_path + ) + logfile = os.path.join(full_path, filename) + try: + f = open(logfile, "w") + except Exception: + return "ERROR: could not open file %s for writing:\n" % logfile + f.write(content) + f.close() + return None + + def analyze(self): """ Retrieve both sets of database representations, perform the comparison and register the resulting change set """ - - def write_file(module, version, content, filename="upgrade_analysis.txt"): - module_path = get_module_path(module) - if not module_path: - return "ERROR: could not find module path:\n" - full_path = os.path.join(module_path, "migrations", version) - if not os.path.exists(full_path): - try: - os.makedirs(full_path) - except os.error: - return "ERROR: could not create migrations directory:\n" - logfile = os.path.join(full_path, filename) - try: - f = open(logfile, "w") - except Exception: - return "ERROR: could not open file %s for writing:\n" % logfile - f.write(content) - f.close() - return None - self.ensure_one() - connection = self.server_config_id.get_connection() - remote_record_obj = connection.env["upgrade.record"] - local_record_obj = self.env["upgrade.record"] + self.write( + { + "analysis_date": fields.Datetime.now(), + } + ) + + connection = self.config_id.get_connection() + RemoteRecord = self._get_remote_model(connection, "record") + LocalRecord = self.env["upgrade.record"] # Retrieve field representations and compare - remote_records = remote_record_obj.field_dump() - local_records = local_record_obj.field_dump() + remote_records = RemoteRecord.field_dump() + local_records = LocalRecord.field_dump() res = compare.compare_sets(remote_records, local_records) # Retrieve xml id representations and compare @@ -74,12 +109,12 @@ class UpgradeAnalysisWizard(models.TransientModel): ] local_xml_records = [ {field: record[field] for field in flds} - for record in local_record_obj.search([("type", "=", "xmlid")]) + for record in LocalRecord.search([("type", "=", "xmlid")]) ] - remote_xml_record_ids = remote_record_obj.search([("type", "=", "xmlid")]) + remote_xml_record_ids = RemoteRecord.search([("type", "=", "xmlid")]) remote_xml_records = [ {field: record[field] for field in flds} - for record in remote_record_obj.read(remote_xml_record_ids, flds) + for record in RemoteRecord.read(remote_xml_record_ids, flds) ] res_xml = compare.compare_xml_sets(remote_xml_records, local_xml_records) @@ -93,12 +128,12 @@ class UpgradeAnalysisWizard(models.TransientModel): ] local_model_records = [ {field: record[field] for field in flds} - for record in local_record_obj.search([("type", "=", "model")]) + for record in LocalRecord.search([("type", "=", "model")]) ] - remote_model_record_ids = remote_record_obj.search([("type", "=", "model")]) + remote_model_record_ids = RemoteRecord.search([("type", "=", "model")]) remote_model_records = [ {field: record[field] for field in flds} - for record in remote_record_obj.read(remote_model_record_ids, flds) + for record in RemoteRecord.read(remote_model_record_ids, flds) ] res_model = compare.compare_model_sets( remote_model_records, local_model_records @@ -124,7 +159,12 @@ class UpgradeAnalysisWizard(models.TransientModel): [("state", "=", "installed")] ) } - general = "" + general_log = "" + + for ignore_module in _IGNORE_MODULES: + if ignore_module in keys: + keys.remove(ignore_module) + for key in keys: contents = "---Models in module '%s'---\n" % key if key in res_model: @@ -144,39 +184,35 @@ class UpgradeAnalysisWizard(models.TransientModel): if key not in res and key not in res_xml and key not in res_model: contents += "---nothing has changed in this module--\n" if key == "general": - general += contents + general_log += contents continue if compare.module_map(key) not in modules: - general += ( + general_log += ( "ERROR: module not in list of installed modules:\n" + contents ) continue if key not in modules: - # no need to log in general the merged/renamed modules + # no need to log in full log the merged/renamed modules continue if self.write_files: - error = write_file(key, modules[key].installed_version, contents) + error = self._write_file(key, modules[key].installed_version, contents) if error: - general += error - general += contents + general_log += error + general_log += contents else: - general += contents + general_log += contents - # Store the general log in as many places as possible ;-) + # Store the full log if self.write_files and "base" in modules: - write_file( + self._write_file( "base", modules["base"].installed_version, - general, + general_log, "upgrade_general_log.txt", ) - self.server_config_id.write({"last_log": general}) - self.write({"state": "ready", "log": general}) - - return { - "name": self._description, - "view_mode": "form", - "res_model": self._name, - "type": "ir.actions.act_window", - "res_id": self.id, - } + self.write( + { + "state": "done", + "log": general_log, + } + ) diff --git a/upgrade_analysis/models/upgrade_comparison_config.py b/upgrade_analysis/models/upgrade_comparison_config.py index 17d60e61f..6bce297ce 100644 --- a/upgrade_analysis/models/upgrade_comparison_config.py +++ b/upgrade_analysis/models/upgrade_comparison_config.py @@ -2,14 +2,12 @@ # Copyright 2016 Opener B.V. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -import logging +import odoorpc -from odoo import fields, models +from odoo import api, fields, models from odoo.exceptions import UserError from odoo.tools.translate import _ -from .. import apriori - class UpgradeComparisonConfig(models.Model): _name = "upgrade.comparison.config" @@ -27,14 +25,23 @@ class UpgradeComparisonConfig(models.Model): password = fields.Char(required=True, default="admin") - last_log = fields.Text() + version = fields.Char() + + analysis_ids = fields.One2many( + string="Analyses", comodel_name="upgrade.analysis", inverse_name="config_id" + ) + analysis_qty = fields.Integer(compute="_compute_analysis_qty") + + @api.depends("analysis_ids") + def _compute_analysis_qty(self): + for config in self: + config.analysis_qty = len(config.analysis_ids) def get_connection(self): self.ensure_one() - import odoorpc - remote = odoorpc.ODOO(self.server, port=self.port) remote.login(self.database, self.username, self.password) + self.version = remote.version return remote def test_connection(self): @@ -46,43 +53,35 @@ class UpgradeComparisonConfig(models.Model): user_info = user_model.read([ids[0]], ["name"])[0] except Exception as e: raise UserError(_("Connection failed.\n\nDETAIL: %s") % e) - raise UserError(_("%s is connected.") % user_info["name"]) - - def analyze(self): - """ Run the analysis wizard """ - self.ensure_one() - wizard = self.env["upgrade.analysis.wizard"].create( - {"server_config_id": self.id} - ) return { - "name": wizard._description, - "view_mode": "form", - "res_model": wizard._name, - "type": "ir.actions.act_window", - "target": "new", - "res_id": wizard.id, - "nodestroy": True, + "type": "ir.actions.client", + "tag": "display_notification", + "params": { + "type": "info", + "message": _( + "You are correctly connected to the server {server}" + " (version {version}) with the user {user_name}" + ).format( + server=self.server, + version=self.version, + user_name=user_info["name"], + ), + }, } - def install_modules(self): - """ Install same modules as in source DB """ + def new_analysis(self): self.ensure_one() - connection = self.get_connection() - remote_module_obj = connection.env["ir.module.module"] - remote_module_ids = remote_module_obj.search([("state", "=", "installed")]) + analysis = self.env["upgrade.analysis"].create({"config_id": self.id}) + return { + "name": analysis._description, + "view_mode": "form", + "res_model": analysis._name, + "type": "ir.actions.act_window", + # "target": "new", + "res_id": analysis.id, + # "nodestroy": True, + } - modules = [] - for module_id in remote_module_ids: - mod = remote_module_obj.read([module_id], ["name"])[0] - mod_name = mod["name"] - mod_name = apriori.renamed_modules.get(mod_name, mod_name) - modules.append(mod_name) - _logger = logging.getLogger(__name__) - _logger.debug("remote modules %s", modules) - local_modules = self.env["ir.module.module"].search( - [("name", "in", modules), ("state", "=", "uninstalled")] - ) - _logger.debug("local modules %s", ",".join(local_modules.mapped("name"))) - if local_modules: - local_modules.write({"state": "to install"}) + def action_show_analysis(self): + self.ensure_one() return {} diff --git a/upgrade_analysis/odoo_patch/__init__.py b/upgrade_analysis/odoo_patch/__init__.py index 1fd6e167c..56a70dbc1 100644 --- a/upgrade_analysis/odoo_patch/__init__.py +++ b/upgrade_analysis/odoo_patch/__init__.py @@ -1,3 +1,2 @@ from . import odoo from . import addons - diff --git a/upgrade_analysis/odoo_patch/addons/mrp/__init__.py b/upgrade_analysis/odoo_patch/addons/mrp/__init__.py index f7b8b8694..925f56ed2 100644 --- a/upgrade_analysis/odoo_patch/addons/mrp/__init__.py +++ b/upgrade_analysis/odoo_patch/addons/mrp/__init__.py @@ -13,7 +13,6 @@ def _pre_init_mrp(cr): # cr.execute("""ALTER TABLE "stock_move" ADD COLUMN "is_done" bool;""") # cr.execute("""UPDATE stock_move # SET is_done=COALESCE(state in ('done', 'cancel'), FALSE);""") - pass # diff --git a/upgrade_analysis/odoo_patch/odoo/models.py b/upgrade_analysis/odoo_patch/odoo/models.py index ee09595fb..201f3f4fe 100644 --- a/upgrade_analysis/odoo_patch/odoo/models.py +++ b/upgrade_analysis/odoo_patch/odoo/models.py @@ -5,7 +5,7 @@ import odoo import psycopg2 from odoo import _ from odoo.models import fix_import_export_id_paths, BaseModel, _logger -from odoo.addons.openupgrade_framework.openupgrade import openupgrade_log +from ... import upgrade_log if True: @@ -154,7 +154,7 @@ if True: batch_xml_ids.add(xid) # # log csv records - openupgrade_log.log_xml_id(self.env.cr, current_module, xid) + upgrade_log.log_xml_id(self.env.cr, current_module, xid) # elif id: record['id'] = id diff --git a/upgrade_analysis/odoo_patch/odoo/modules/loading.py b/upgrade_analysis/odoo_patch/odoo/modules/loading.py index eb25c80ad..4194fdc62 100644 --- a/upgrade_analysis/odoo_patch/odoo/modules/loading.py +++ b/upgrade_analysis/odoo_patch/odoo/modules/loading.py @@ -13,7 +13,7 @@ from odoo.modules import loading from odoo.modules.module import adapt_version, load_openerp_module, initialize_sys_path from odoo.modules.loading import load_data, load_demo, _check_module_names -from odoo.addons.openupgrade_framework.openupgrade import openupgrade_loading +from .... import upgrade_loading import os @@ -118,8 +118,8 @@ def _load_module_graph(cr, graph, status=None, perform_checks=True, for model in env.values(): if not model._auto: continue - openupgrade_loading.log_model(model, local_registry) - openupgrade_loading.compare_registries( + upgrade_loading.log_model(model, local_registry) + upgrade_loading.compare_registries( cr, package.name, upg_registry, local_registry) # @@ -289,7 +289,7 @@ def _load_marked_modules(cr, graph, states, force, progressdict, report, cr.execute("SELECT name from ir_module_module WHERE state IN %s" ,(tuple(states),)) module_list = [name for (name,) in cr.fetchall() if name not in graph] # - module_list = openupgrade_loading.add_module_dependencies(cr, module_list) + module_list = upgrade_loading.add_module_dependencies(cr, module_list) # if not module_list: break diff --git a/upgrade_analysis/odoo_patch/odoo/tools/convert.py b/upgrade_analysis/odoo_patch/odoo/tools/convert.py index 2af712a22..8c1f710a5 100644 --- a/upgrade_analysis/odoo_patch/odoo/tools/convert.py +++ b/upgrade_analysis/odoo_patch/odoo/tools/convert.py @@ -18,6 +18,6 @@ form: module.record_id""" % (xml_id,) assert modcnt == 1, """The ID "%s" refers to an uninstalled module""" % (xml_id,) # OpenUpgrade: log entry of XML imports - openupgrade_log.log_xml_id(self.env.cr, self.module, xml_id) + upgrade_log.log_xml_id(self.env.cr, self.module, xml_id) xml_import._test_xml_id = __test_xml_id diff --git a/upgrade_analysis/security/ir.model.access.csv b/upgrade_analysis/security/ir.model.access.csv index 5d835a8a9..1025e9e72 100644 --- a/upgrade_analysis/security/ir.model.access.csv +++ b/upgrade_analysis/security/ir.model.access.csv @@ -2,6 +2,6 @@ id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink access_upgrade_record,upgrade.record all,model_upgrade_record,,1,0,0,0 access_upgrade_attribute,upgrade.attribute all,model_upgrade_attribute,,1,0,0,0 access_upgrade_comparison_config,upgrade.comparison.config,model_upgrade_comparison_config,base.group_system,1,1,1,1 -access_upgrade_analysis_wizard,access_upgrade_analysis_wizard,model_upgrade_analysis_wizard,base.group_system,1,1,1,1 +access_upgrade_analysis,access_upgrade_analysis,model_upgrade_analysis,base.group_system,1,1,1,1 access_upgrade_generate_record_wizard,access_upgrade_generate_record_wizard,model_upgrade_generate_record_wizard,base.group_system,1,1,1,1 access_upgrade_install_wizard,access_upgrade_install_wizard,model_upgrade_install_wizard,base.group_system,1,1,1,1 diff --git a/upgrade_analysis/openupgrade_loading.py b/upgrade_analysis/upgrade_loading.py similarity index 94% rename from upgrade_analysis/openupgrade_loading.py rename to upgrade_analysis/upgrade_loading.py index ca3e1d430..1187a5900 100644 --- a/upgrade_analysis/openupgrade_loading.py +++ b/upgrade_analysis/upgrade_loading.py @@ -10,13 +10,13 @@ from openupgradelib.openupgrade_tools import table_exists from odoo import release from odoo.modules.module import get_module_path -from odoo.tools.safe_eval import safe_eval from odoo.tools.config import config +from odoo.tools.safe_eval import safe_eval # A collection of functions used in # odoo/modules/loading.py -logger = logging.getLogger("OpenUpgrade") +_logger = logging.getLogger(__name__) def add_module_dependencies(cr, module_list): @@ -104,7 +104,7 @@ def add_module_dependencies(cr, module_list): ) auto_modules = [row[0] for row in cr.fetchall() if get_module_path(row[0])] if auto_modules: - logger.info("Selecting autoinstallable modules %s", ",".join(auto_modules)) + _logger.info("Selecting autoinstallable modules %s", ",".join(auto_modules)) module_list += auto_modules # Set proper state for new dependencies so that any init scripts are run @@ -213,7 +213,7 @@ def get_record_id(cr, module, model, field, mode): the key parameter values """ cr.execute( - "SELECT id FROM openupgrade_record " + "SELECT id FROM upgrade_record " "WHERE module = %s AND model = %s AND " "field = %s AND mode = %s AND type = %s", (module, model, field, mode, "field"), @@ -222,13 +222,13 @@ def get_record_id(cr, module, model, field, mode): if record: return record[0] cr.execute( - "INSERT INTO openupgrade_record " + "INSERT INTO upgrade_record " "(module, model, field, mode, type) " "VALUES (%s, %s, %s, %s, %s)", (module, model, field, mode, "field"), ) cr.execute( - "SELECT id FROM openupgrade_record " + "SELECT id FROM upgrade_record " "WHERE module = %s AND model = %s AND " "field = %s AND mode = %s AND type = %s", (module, model, field, mode, "field"), @@ -242,7 +242,7 @@ def compare_registries(cr, module, registry, local_registry): log any differences and merge the local registry with the global one. """ - if not table_exists(cr, "openupgrade_record"): + if not table_exists(cr, "upgrade_record"): return for model, flds in local_registry.items(): registry.setdefault(model, {}) @@ -255,14 +255,14 @@ def compare_registries(cr, module, registry, local_registry): if not record_id: record_id = get_record_id(cr, module, model, field, mode) cr.execute( - "SELECT id FROM openupgrade_attribute " + "SELECT id FROM upgrade_attribute " "WHERE name = %s AND value = %s AND " "record_id = %s", (key, value, record_id), ) if not cr.fetchone(): cr.execute( - "INSERT INTO openupgrade_attribute " + "INSERT INTO upgrade_attribute " "(name, value, record_id) VALUES (%s, %s, %s)", (key, value, record_id), ) @@ -295,7 +295,7 @@ def update_field_xmlid(model, field): and rec["module"] != model.env.context["module"] and rec["module"] not in model.env.registry._init_modules ): - logging.getLogger(__name__).info( + _logger.info( "Moving XMLID for ir.model.fields record of %s#%s " "from %s to %s", model._name, rec["name"], @@ -308,9 +308,7 @@ def update_field_xmlid(model, field): dict(rec, module=model.env.context["module"]), ) if model.env.cr.fetchone(): - logging.getLogger(__name__).info( - "Aborting, an XMLID for this module already exists." - ) + _logger.info("Aborting, an XMLID for this module already exists.") continue model.env.cr.execute( "UPDATE ir_model_data SET module=%(module)s " "WHERE id=%(xmlid_id)s", diff --git a/upgrade_analysis/openupgrade_log.py b/upgrade_analysis/upgrade_log.py similarity index 74% rename from upgrade_analysis/openupgrade_log.py rename to upgrade_analysis/upgrade_log.py index 81c891673..2563ecbc6 100644 --- a/upgrade_analysis/openupgrade_log.py +++ b/upgrade_analysis/upgrade_log.py @@ -1,10 +1,13 @@ -# coding: utf-8 # Copyright 2011-2015 Therp BV # Copyright 2016 Opener B.V. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +import logging + from openupgradelib.openupgrade_tools import table_exists +_logger = logging.getLogger(__name__) + def log_xml_id(cr, module, xml_id): """ @@ -24,7 +27,7 @@ def log_xml_id(cr, module, xml_id): get any meaningful results until the *second* time that you 'init' the module. - - The good news is that the openupgrade_records module that comes + - The good news is that the upgrade_analysis module that comes with this distribution allows you to deal with all of this with one click on the menu item Settings -> Customizations -> Database Structure -> OpenUpgrade -> Generate Records @@ -36,25 +39,27 @@ def log_xml_id(cr, module, xml_id): :param module: The module that contains the xml_id :param xml_id: the xml_id, with or without 'module.' prefix """ - if not table_exists(cr, 'openupgrade_record'): + if not table_exists(cr, "upgrade_record"): return - if '.' not in xml_id: - xml_id = '%s.%s' % (module, xml_id) + if "." not in xml_id: + xml_id = "{}.{}".format(module, xml_id) cr.execute( - "SELECT model FROM ir_model_data " - "WHERE module = %s AND name = %s", - xml_id.split('.')) + "SELECT model FROM ir_model_data " "WHERE module = %s AND name = %s", + xml_id.split("."), + ) record = cr.fetchone() if not record: - print("Cannot find xml_id %s" % xml_id) + _logger.warning("Cannot find xml_id %s" % xml_id) return else: cr.execute( - "SELECT id FROM openupgrade_record " + "SELECT id FROM upgrade_record " "WHERE module=%s AND model=%s AND name=%s AND type=%s", - (module, record[0], xml_id, 'xmlid')) + (module, record[0], xml_id, "xmlid"), + ) if not cr.fetchone(): cr.execute( - "INSERT INTO openupgrade_record " + "INSERT INTO upgrade_record " "(module, model, name, type) values(%s, %s, %s, %s)", - (module, record[0], xml_id, 'xmlid')) + (module, record[0], xml_id, "xmlid"), + ) diff --git a/upgrade_analysis/views/view_upgrade_analysis.xml b/upgrade_analysis/views/view_upgrade_analysis.xml new file mode 100644 index 000000000..375253ce9 --- /dev/null +++ b/upgrade_analysis/views/view_upgrade_analysis.xml @@ -0,0 +1,71 @@ + + + + + upgrade.analysis + + + + + + + + + + + upgrade.analysis + +
+
+ +
+ + + + + + + + + + + +
+
+
+ + + Upgrade Analyses + ir.actions.act_window + upgrade.analysis + + + + +
diff --git a/upgrade_analysis/views/view_upgrade_comparison_config.xml b/upgrade_analysis/views/view_upgrade_comparison_config.xml index 9d98c47a2..475d6e186 100644 --- a/upgrade_analysis/views/view_upgrade_comparison_config.xml +++ b/upgrade_analysis/views/view_upgrade_comparison_config.xml @@ -17,39 +17,48 @@ upgrade.comparison.config
- - - - - - - - - + + + + + + + + + + +