X-Git-Url: http://git.inspyration.org/?a=blobdiff_plain;f=addons%2Fwebsite%2Fmodels%2Fwebsite.py;fp=addons%2Fwebsite%2Fmodels%2Fwebsite.py;h=49716a96bf23c1e15c720078c77603b6dfefa10c;hb=c15f748be05b3709f5e16680569abdc2949468e2;hp=0d7e80283395689c69e1ab92781d587c320c30a2;hpb=1dbf153eb51303c4186ca5e2dacd729aadd95f28;p=odoo%2Fodoo.git diff --git a/addons/website/models/website.py b/addons/website/models/website.py index 0d7e802..49716a9 100644 --- a/addons/website/models/website.py +++ b/addons/website/models/website.py @@ -709,12 +709,12 @@ class ir_attachment(osv.osv): result[attach.id] = self.pool['website'].image_url(cr, uid, attach, 'datas') return result def _datas_checksum(self, cr, uid, ids, name, arg, context=None): - return dict( - (attach['id'], self._compute_checksum(attach)) - for attach in self.read( - cr, uid, ids, ['res_model', 'res_id', 'type', 'datas'], - context=context) - ) + result = dict.fromkeys(ids, False) + attachments = self.read(cr, uid, ids, ['res_model'], context=context) + view_attachment_ids = [attachment['id'] for attachment in attachments if attachment['res_model'] == 'ir.ui.view'] + for attach in self.read(cr, uid, view_attachment_ids, ['res_model', 'res_id', 'type', 'datas'], context=context): + result[attach['id']] = self._compute_checksum(attach) + return result def _compute_checksum(self, attachment_dict): if attachment_dict.get('res_model') == 'ir.ui.view'\ @@ -730,7 +730,7 @@ class ir_attachment(osv.osv): return result for record in self.browse(cr, uid, ids, context=context): - if not record.datas: continue + if record.res_model != 'ir.ui.view' or not record.datas: continue try: result[record.id] = openerp.tools.image_resize_image_big(record.datas) except IOError: # apparently the error PIL.Image.open raises