Skip to content

Commit

Permalink
[FIX] odoo_patch: don't raise or log exceptions in view validation
Browse files Browse the repository at this point in the history
unless explicitely requested
  • Loading branch information
royle-vietnam committed May 15, 2024
1 parent 60aafc4 commit 363550f
Showing 1 changed file with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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):
Expand Down

0 comments on commit 363550f

Please sign in to comment.