diff --git a/addons/website/models/ir_qweb.py b/addons/website/models/ir_qweb.py index ad2b63a6dd9..40b407a040a 100644 --- a/addons/website/models/ir_qweb.py +++ b/addons/website/models/ir_qweb.py @@ -265,10 +265,16 @@ class Image(orm.AbstractModel): if options is None: options = {} classes = ['img', 'img-responsive'] + options.get('class', '').split() - return ir_qweb.HTMLSafe('' % ( + size_params = [] + if options.has_key('max_width'): + size_params.append("max_width=%i" % options['max_width']) + if options.has_key('max_height'): + size_params.append("max_height=%i" % options['max_height']) + + return ir_qweb.HTMLSafe('' % ( ' '.join(itertools.imap(werkzeug.utils.escape, classes)), record._model._name, - field_name, record.id)) + field_name, record.id, '&'.join(size_params))) local_url_re = re.compile(r'^/(?P[^]]+)/static/(?P.+)$') def from_html(self, cr, uid, model, column, element, context=None):