From 363550fe4027d57fa614cc3dd8005297462b7dc3 Mon Sep 17 00:00:00 2001 From: Roy Le Date: Tue, 14 May 2024 17:23:50 +0700 Subject: [PATCH] [FIX] odoo_patch: don't raise or log exceptions in view validation unless explicitely requested --- .../odoo/addons/base/models/ir_ui_view.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/openupgrade_framework/odoo_patch/odoo/addons/base/models/ir_ui_view.py b/openupgrade_framework/odoo_patch/odoo/addons/base/models/ir_ui_view.py index 88fa084e1976..0cec05eab184 100644 --- a/openupgrade_framework/odoo_patch/odoo/addons/base/models/ir_ui_view.py +++ b/openupgrade_framework/odoo_patch/odoo/addons/base/models/ir_ui_view.py @@ -1,8 +1,10 @@ +# Copyright 2024 Viindoo Technology Joint Stock Company (Viindoo) # Copyright Odoo Community Association (OCA) # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). import logging from odoo import api +from odoo.exceptions import ValidationError from odoo.tools import mute_logger from odoo.addons.base.models.ir_ui_view import NameManager, View @@ -12,9 +14,21 @@ @api.constrains("arch_db") def _check_xml(self): - """Mute warnings about views which are common during migration""" + """Don't raise or log exceptions in view validation unless explicitely + requested. Mute warnings about views which are common during migration.""" with mute_logger("odoo.addons.base.models.ir_ui_view"): - return View._check_xml._original_method(self) + try: + return View._check_xml._original_method(self) + except ValidationError as e: + _logger.warning( + "Can't render custom view %s for model %s. " + "Assuming you are migrating between major versions of Odoo. " + "Please review the view contents manually after the migration.\n" + "Error: %s", + self.xml_id, + self.model, + e, + ) def check(self, view):