[FIX] website: server images for website_published records

- When a record has `website_published` field set at True the method
  `binary_content` on `ir.http` should bypass the access rules and
  always deserve the content.

  This wasn't the case due to a mistake on the code. The code is
  checking the access rules and may in some cases not return the
  content.

closes odoo/odoo#31068
This commit is contained in:
Toufik Ben Jaa
2019-02-13 13:48:33 +00:00
parent 98e3ca4e67
commit e8b28c02a0
+1 -1
View File
@@ -250,7 +250,7 @@ class Http(models.AbstractModel):
obj = self.env[model].browse(int(id))
if obj and 'website_published' in obj._fields:
if self.env[obj._name].sudo().search([('id', '=', obj.id), ('website_published', '=', True)]):
self.sudo()
self = self.sudo()
return super(Http, self).binary_content(
xmlid=xmlid, model=model, id=id, field=field, unique=unique, filename=filename,
filename_field=filename_field, download=download, mimetype=mimetype,