[FIX] check_field_access_rights: ignore nonexisting fields
It seems name_alias is requested but does not exist. bzr revid: vmt@openerp.com-20121212151509-22494edob4e3fqaf
This commit is contained in:
parent
1a4fd71880
commit
eb0fcc35d2
|
@ -3545,6 +3545,10 @@ class BaseModel(object):
|
|||
"""
|
||||
def p(field_name):
|
||||
"""Predicate to test if the user has access to the given field name."""
|
||||
# Ignore requested field if it doesn't exist. This is ugly but
|
||||
# it seems to happen at least with 'name_alias' on res.partner.
|
||||
if field_name not in self._all_columns:
|
||||
return True
|
||||
field = self._all_columns[field_name].column
|
||||
if field.groups:
|
||||
return self.user_has_groups(cr, user, groups=field.groups, context=context)
|
||||
|
|
|
@ -84,7 +84,7 @@ class TestRelatedField(common.TransactionCase):
|
|||
'related_related_company_id': fields.related('single_related_company_id', type='many2one', obj='res.company'),
|
||||
})
|
||||
self.partner._all_columns.update({
|
||||
'single_related_company_id': fields.column_info('single_related_company_id', self.partner._columns['single_related_company_id'], None, None, None)
|
||||
'single_related_company_id': fields.column_info('single_related_company_id', self.partner._columns['single_related_company_id'], None, None, None),
|
||||
'related_related_company_id': fields.column_info('related_related_company_id', self.partner._columns['related_related_company_id'], None, None, None)
|
||||
})
|
||||
|
||||
|
|
Loading…
Reference in New Issue