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
This commit is contained in:
Naresh Choksy 2008-10-08 15:06:17 +05:30
parent 7b22870509
commit 5a5f8d6069
1 changed files with 10 additions and 0 deletions

View File

@ -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)):