From cf8a59c25050a8b6d53dad90769d16cd74f4228c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Thu, 26 Nov 2015 18:07:04 +0100 Subject: [PATCH] [FIX] res_partner: default image in testing When in testing mode there is no need to compute the default image. Indeed this information is rarely necessary for testing purpose. For the whole set of Odoo tests, removing the default image computation in test mode makes a gain of ~10 minuts of computation. --- openerp/addons/base/res/res_partner.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/openerp/addons/base/res/res_partner.py b/openerp/addons/base/res/res_partner.py index ac825fad91a..db2c3458847 100644 --- a/openerp/addons/base/res/res_partner.py +++ b/openerp/addons/base/res/res_partner.py @@ -7,6 +7,7 @@ import hashlib from lxml import etree import math import pytz +import threading import urllib2 import urlparse @@ -17,7 +18,6 @@ from openerp.osv.expression import get_unaccent_wrapper from openerp.tools.translate import _ from openerp.exceptions import UserError - ADDRESS_FORMAT_LAYOUTS = { '%(city)s %(state_code)s\n%(zip)s': """
@@ -305,6 +305,9 @@ class res_partner(osv.Model, format_address): @api.model def _get_default_image(self, partner_type, is_company, parent_id): + if getattr(threading.currentThread(), 'testing', False): + return False + colorize, img_path, image = False, False, False if partner_type in ['contact', 'other'] and parent_id: