[FIX] base, tools: raise logger warning while invalid attribute added to a field
This error occurs when a user tries to add an Invalid attribute (ex-help, searchable) to an element field. Steps to produce: - Install Studio. - Open any tree view. - Activate studio > Go to views > Click on XML. - Add an attribute help inside any field. So, this commit handles the case by changing the logger error to logger warning. sentry-4377111502 closes odoo/odoo#131164 X-original-commit: 10f45eacdfd4c6fe5d86659276d145a563f60c6c Signed-off-by: Fabien Pinckaers (fp) <fp@odoo.com> Signed-off-by: Rémy Voet (ryv) <ryv@odoo.com>
This commit is contained in:
@@ -402,9 +402,6 @@ actual arch.
|
||||
'Invalid view %(name)s definition in %(file)s',
|
||||
name=view_name, file=view.arch_fs
|
||||
))
|
||||
if check == "Warning":
|
||||
view_name = f'{view.name} ({view.xml_id})' if view.xml_id else view.name
|
||||
_logger.warning('Invalid view %s definition in %s \n%s', view_name, view.arch_fs, view.arch)
|
||||
except ValueError as e:
|
||||
if hasattr(e, 'context'):
|
||||
lines = etree.tostring(combined_arch, encoding='unicode').splitlines(keepends=True)
|
||||
|
||||
@@ -280,11 +280,8 @@ def valid_view(arch, **kwargs):
|
||||
for pred in _validators[arch.tag]:
|
||||
check = pred(arch, **kwargs)
|
||||
if not check:
|
||||
_logger.error("Invalid XML when check %s: %s", arch.tag, pred.__doc__)
|
||||
_logger.warning("Invalid XML: %s", pred.__doc__)
|
||||
return False
|
||||
if check == "Warning":
|
||||
_logger.warning("Invalid XML when check %s: %s", arch.tag, pred.__doc__)
|
||||
return "Warning"
|
||||
return True
|
||||
|
||||
|
||||
@@ -318,7 +315,7 @@ def schema_valid(arch, **kwargs):
|
||||
if validator and not validator.validate(arch):
|
||||
result = True
|
||||
for error in validator.error_log:
|
||||
_logger.error(tools.ustr(error))
|
||||
_logger.warning(tools.ustr(error))
|
||||
result = False
|
||||
return result
|
||||
return True
|
||||
|
||||
Reference in New Issue
Block a user