[FIX] website: display website_published image without access to the model

Issue: if the user don't have any access to the model, _image method raise an exception instead of display the website_published images.
This commit is contained in:
Christophe Matthieu 2015-12-10 10:02:37 +01:00
parent 25b56671c1
commit 8a0b4ca39f
1 changed files with 4 additions and 2 deletions

View File

@ -535,8 +535,10 @@ class website(osv.osv):
Model = self.pool[model]
id = int(id)
ids = Model.search(cr, uid,
[('id', '=', id)], context=context)
ids = None
if Model.check_access_rights(cr, uid, 'read', raise_exception=False):
ids = Model.search(cr, uid,
[('id', '=', id)], context=context)
if not ids and 'website_published' in Model._fields:
ids = Model.search(cr, openerp.SUPERUSER_ID,
[('id', '=', id), ('website_published', '=', True)], context=context)