[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.
This commit is contained in:
Thibault Delavallée
2015-11-30 12:50:47 +01:00
parent a3fe7723d1
commit cf8a59c250
+4 -1
View File
@@ -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': """
<div class="address_format">
@@ -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: