From 063ee0751b6eb778454d567b4459616be40d4c46 Mon Sep 17 00:00:00 2001 From: George Daramouskas Date: Sun, 14 May 2017 11:43:08 +0300 Subject: [PATCH] [FIX] base/ir_ui_view: Raise ValidationError when creating views without arch/type Closes #16973 Steps to reproduce: 1) Go to Settings -> Technical -> User Interface -> Views 2) Create a new view and give only name, leave fields View Type and arch_base empty. 3) Exception occures Current behaviour: - The user gets an exception with a full stacktrace. Expected behaviour: - The user should get a warning --- odoo/addons/base/ir/ir_ui_view.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/odoo/addons/base/ir/ir_ui_view.py b/odoo/addons/base/ir/ir_ui_view.py index 55edfec992e..66cf87c7ee9 100644 --- a/odoo/addons/base/ir/ir_ui_view.py +++ b/odoo/addons/base/ir/ir_ui_view.py @@ -341,6 +341,8 @@ actual arch. else: try: + if not values.get('arch') and not values.get('arch_base'): + raise ValidationError(_('Missing view architecture.')) values['type'] = etree.fromstring(values.get('arch') or values.get('arch_base')).tag except LxmlError: # don't raise here, the constraint that runs `self._check_xml` will