From 05e02059f0cdbe179a25b68dee5ca26f5e5acca0 Mon Sep 17 00:00:00 2001 From: Sagar Ahirrao Date: Wed, 22 Mar 2017 16:10:25 +0530 Subject: [PATCH] [IMP] base: resize partner image with actual aspect ratio Purpose of this commit is to finally stop adding extra padding to website logo. Indeed not giving square logos lead to padding added to images, leading to not so beautiful logo that makes people sad. Before this commit * partner's image was resized to square 1024x1024. Extra padding was added if user provided rectangle image; * due to this website logo resized to square when rectangle logo provided; After this commit, * sizes dict can be passed in image resizer of tools; * e.g. tools.image_resize_images(vals, sizes={'image': (512, 512), 'image_small': (128, 128)}) * image field in partner will resize with max width 1024 and height based on given image ratio (still image_medium, image_small will be default square images); * now website logo will respect actual aspect ratio This commit is related to task ID 31994 . Future commits should probably clean all that mess, but at least it seems we have something that works. --- .../website_crm_partner_assign_templates.xml | 4 ++-- .../views/website_partner_templates.xml | 2 +- odoo/addons/base/models/res_partner.py | 4 ++-- odoo/tools/image.py | 19 +++++++++++-------- 4 files changed, 16 insertions(+), 13 deletions(-) diff --git a/addons/website_crm_partner_assign/views/website_crm_partner_assign_templates.xml b/addons/website_crm_partner_assign/views/website_crm_partner_assign_templates.xml index 35a5d8cf256..c07c7577e45 100644 --- a/addons/website_crm_partner_assign/views/website_crm_partner_assign_templates.xml +++ b/addons/website_crm_partner_assign/views/website_crm_partner_assign_templates.xml @@ -89,8 +89,8 @@