From 5a5f8d6069ec834dc6e6f4764e469a118506e2b8 Mon Sep 17 00:00:00 2001 From: Naresh Choksy Date: Wed, 8 Oct 2008 15:06:17 +0530 Subject: [PATCH] Added test in the view inheritancies to be sure the inherited view has the same model than the base view. Raised an exception if not bzr revid: nch@tinyerp.com-20081008093617-8z1wszxlee25escf --- bin/addons/base/ir/ir_ui_view.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/bin/addons/base/ir/ir_ui_view.py b/bin/addons/base/ir/ir_ui_view.py index 276568c9e31..203055b705f 100644 --- a/bin/addons/base/ir/ir_ui_view.py +++ b/bin/addons/base/ir/ir_ui_view.py @@ -80,6 +80,16 @@ class view(osv.osv): (_check_xml, 'Invalid XML for View Architecture!', ['arch']) ] + def create(self, cr, uid, vals, context={}): + if 'inherit_id' in vals: + obj=self.browse(cr,uid,vals['inherit_id']) + if not obj.model==vals['model']: + raise Exception("Inherited view model [%s] and \ + \n\n base view model [%s] do not match \ + \n\n It should be same as base view model " \ + %(vals['model'],obj.model)) + return super(view,self).create(cr, uid, vals, context={}) + def read(self, cr, uid, ids, fields=None, context={}, load='_classic_read'): if not isinstance(ids, (list, tuple)):