diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py index 2966b34ab19..3526883e45e 100644 --- a/addons/web/controllers/main.py +++ b/addons/web/controllers/main.py @@ -1358,6 +1358,11 @@ class Binary(openerpweb.Controller): image_data = self.placeholder(req) headers.append(('ETag', retag)) headers.append(('Content-Length', len(image_data))) + try: + ncache = int(kw.get('cache')) + headers.append(('Cache-Control', 'no-cache' if ncache == 0 else 'max-age=%s' % (ncache))) + except: + pass return req.make_response(image_data, headers) def placeholder(self, req): addons_path = openerpweb.addons_manifest['web']['addons_path'] diff --git a/addons/web_kanban/static/src/js/kanban.js b/addons/web_kanban/static/src/js/kanban.js index 2b123468260..879894e97c7 100644 --- a/addons/web_kanban/static/src/js/kanban.js +++ b/addons/web_kanban/static/src/js/kanban.js @@ -740,9 +740,13 @@ instance.web_kanban.KanbanRecord = instance.web.OldWidget.extend({ var email_md5 = $.md5(email); return 'http://www.gravatar.com/avatar/' + email_md5 + '.png?s=' + size + '&d=' + default_; }, - kanban_image: function(model, field, id) { + kanban_image: function(model, field, id, cache) { id = id || ''; var url = instance.connection.prefix + '/web/binary/image?session_id=' + this.session.session_id + '&model=' + model + '&field=' + field + '&id=' + id; + if (cache !== undefined) { + // Set the cache duration in seconds. + url += '&cache=' + parseInt(cache, 10); + } return url; }, kanban_text_ellipsis: function(s, size) {