Skip to content
Snippets Groups Projects
Commit 2bebba76 authored by Denis Ledoux's avatar Denis Ledoux
Browse files

[FIX] website: image_url fallback when no write_date

parent da1e9412
No related branches found
No related tags found
No related merge requests found
...@@ -602,7 +602,8 @@ class website(osv.osv): ...@@ -602,7 +602,8 @@ class website(osv.osv):
def image_url(self, cr, uid, record, field, size=None, context=None): 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.""" """Returns a local url that points to the image field of a given browse record."""
model = record._name 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 size = '' if size is None else '/%s' % size
return '/website/image/%s/%s/%s%s' % (model, id, field, size) return '/website/image/%s/%s/%s%s' % (model, id, field, size)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment