[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
This commit is contained in:
Martin Trigaux
2016-02-19 17:46:03 +01:00
parent 35c42e15c0
commit 25c45a61bf
+3 -2
View File
@@ -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