[FIX] website: image_url fallback when no write_date

This commit is contained in:
Denis Ledoux 2014-12-12 13:08:45 +01:00
parent da1e9412f8
commit 2bebba76d0
1 changed files with 2 additions and 1 deletions

View File

@ -602,7 +602,8 @@ class website(osv.osv):
def image_url(self, cr, uid, record, field, size=None, context=None):
"""Returns a local url that points to the image field of a given browse record."""
model = record._name
id = '%s_%s' % (record.id, hashlib.sha1(record.sudo().write_date).hexdigest()[0:7])
sudo_record = record.sudo()
id = '%s_%s' % (record.id, hashlib.sha1(sudo_record.write_date or sudo_record.create_date or '').hexdigest()[0:7])
size = '' if size is None else '/%s' % size
return '/website/image/%s/%s/%s%s' % (model, id, field, size)