diff --git a/addons/product/models/product.py b/addons/product/models/product.py index 99a314662dd..4d566f2b100 100644 --- a/addons/product/models/product.py +++ b/addons/product/models/product.py @@ -168,7 +168,7 @@ class ProductProduct(models.Model): for record in self: images = tools.image_get_resized_images(record.image_raw_original, big_name=False) record.image_raw_big = tools.image_get_resized_images(record.image_raw_original, - large_name=False, medium_name=False, small_name=False, preserve_aspect_ratio=True)['image'] + large_name=False, medium_name=False, small_name=False)['image'] record.image_raw_large = images['image_large'] record.image_raw_medium = images['image_medium'] record.image_raw_small = images['image_small'] diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py index dc345e047ed..226d5347e84 100644 --- a/addons/web/controllers/main.py +++ b/addons/web/controllers/main.py @@ -1023,8 +1023,8 @@ class Binary(http.Controller): '/web/image/-/x/'], type='http', auth="public") def content_image(self, xmlid=None, model='ir.attachment', id=None, field='datas', filename_field='datas_fname', unique=None, filename=None, mimetype=None, - download=None, width=0, height=0, crop=False, access_token=None, avoid_if_small=False, - upper_limit=False, placeholder='placeholder.png', **kw): + download=None, width=0, height=0, crop=False, access_token=None, + placeholder='placeholder.png', **kwargs): status, headers, image_base64 = request.env['ir.http'].binary_content( xmlid=xmlid, model=model, id=id, field=field, unique=unique, filename=filename, filename_field=filename_field, download=download, mimetype=mimetype, @@ -1041,7 +1041,7 @@ class Binary(http.Controller): image_base64 = getattr(odoo.tools, 'image_resize_image_%s' % suffix)(image_base64) image_base64 = limited_image_resize( - image_base64, width=width, height=height, crop=crop, upper_limit=upper_limit, avoid_if_small=avoid_if_small) + image_base64, width=width, height=height, crop=crop) content = base64.b64decode(image_base64) headers.append(('Content-Length', len(content))) diff --git a/addons/web/models/ir_qweb.py b/addons/web/models/ir_qweb.py index d1d792e8f54..e8a966647e3 100644 --- a/addons/web/models/ir_qweb.py +++ b/addons/web/models/ir_qweb.py @@ -45,7 +45,6 @@ class Image(models.AbstractModel): sha = hashlib.sha1(str(getattr(record, '__last_update')).encode('utf-8')).hexdigest()[0:7] max_size = '' if max_size is None else '/%s' % max_size - avoid_if_small = '&avoid_if_small=true' if options.get('avoid_if_small') else '' if options.get('filename-field') and getattr(record, options['filename-field'], None): filename = record[options['filename-field']] @@ -54,7 +53,7 @@ class Image(models.AbstractModel): else: filename = record.display_name - src = '/web/image/%s/%s/%s%s/%s?unique=%s%s' % (record._name, record.id, options.get('preview_image', field_name), max_size, url_quote(filename), sha, avoid_if_small) + src = '/web/image/%s/%s/%s%s/%s?unique=%s' % (record._name, record.id, options.get('preview_image', field_name), max_size, url_quote(filename), sha) if options.get('alt-field') and getattr(record, options['alt-field'], None): alt = escape(record[options['alt-field']]) diff --git a/addons/web/tests/test_image.py b/addons/web/tests/test_image.py index e17073d0fb7..1e4b0c3c5b5 100644 --- a/addons/web/tests/test_image.py +++ b/addons/web/tests/test_image.py @@ -13,10 +13,10 @@ class TestImage(HttpCase): """The goal of this test is to make sure the placeholder image is resized appropriately depending on the given URL parameters.""" - # CASE: resize placeholder to given size + # CASE: resize placeholder, given size but original ratio is always kept response = self.url_open('/web/image/0/200x150') image = Image.open(io.BytesIO(response.content)) - self.assertEqual(image.size, (200, 150)) + self.assertEqual(image.size, (150, 150)) # CASE: resize placeholder to small response = self.url_open('/web/image/fake/0/image_small') diff --git a/addons/website_partner/views/website_partner_templates.xml b/addons/website_partner/views/website_partner_templates.xml index c8682008619..2f5c58b1dee 100644 --- a/addons/website_partner/views/website_partner_templates.xml +++ b/addons/website_partner/views/website_partner_templates.xml @@ -17,7 +17,7 @@