From 25c45a61bf07820168d88be71bb38c8d4211d4ed Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Fri, 19 Feb 2016 17:13:30 +0100 Subject: [PATCH] [FIX] base: creation of delivery or invoice partner The image that is set based on the type should not be colorized as it has no transparency (image_colorize method would fail). The _get_default_image is called explicitely to pass False to colorize attribute. A proper refactoring of the method _get_default_image has been done at 66d4de7 but for 9.0 versions, makes this minimal hack without changing signature method. Fixes #11027 --- openerp/addons/base/res/res_partner.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/openerp/addons/base/res/res_partner.py b/openerp/addons/base/res/res_partner.py index e43a47e01ea..441ca612935 100644 --- a/openerp/addons/base/res/res_partner.py +++ b/openerp/addons/base/res/res_partner.py @@ -549,8 +549,9 @@ class res_partner(osv.Model, format_address): @api.model def create(self, vals): - if vals.get('type') and not self._context.get('partner_type'): - self = self.with_context(partner_type=vals['type']) + if vals.get('type') in ['delivery', 'invoice'] and not vals.get('image'): + # force no colorize for images with no transparency + vals['image'] = self.with_context(partner_type=vals['type'])._get_default_image(False, False) if vals.get('website'): vals['website'] = self._clean_website(vals['website']) # function field not correctly triggered at create -> remove me when