From 8939fe0587fc7dc44259656c41b3a79b73260121 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Fri, 3 Oct 2008 01:00:40 +0200 Subject: [PATCH] Add test for inherit view to have the same model than the inherited one --- trytond/ir/ui/view.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/trytond/ir/ui/view.py b/trytond/ir/ui/view.py index 9ddf7480e3..bf7f2e1c5f 100644 --- a/trytond/ir/ui/view.py +++ b/trytond/ir/ui/view.py @@ -64,6 +64,14 @@ class View(OSV): xml = view.arch.strip() tree = etree.fromstring(xml) + if view.inherit: + if view.model != view.inherit.model: + logger = logging.getLogger('ir') + logger.error('Invalid model "%s" ' \ + 'with inherited model "%"' % \ + (view.model, view.inherit.model)) + return False + # validate the tree using RelaxNG rng_name = os.path.join(os.path.dirname(__file__), (view.inherit and view.inherit.type or view.type) + '.rng')