|
@ -514,12 +514,14 @@ class res_partner_address(osv.osv): |
|
|
|
|
|
|
|
|
def get_partner_from_phone_number(self, cr, uid, number, context=None): |
|
|
def get_partner_from_phone_number(self, cr, uid, number, context=None): |
|
|
# We check that "number" is really a number |
|
|
# We check that "number" is really a number |
|
|
|
|
|
_logger.debug(u"Call get_name_from_phone_number with number = %s" % number) |
|
|
if not isinstance(number, str): |
|
|
if not isinstance(number, str): |
|
|
|
|
|
_logger.warning(u"Number should be a 'str' but it is a '%s'" % type(number)) |
|
|
return False |
|
|
return False |
|
|
|
|
|
_logger.warning(u"Number should only contain digits.") |
|
|
if not number.isdigit(): |
|
|
if not number.isdigit(): |
|
|
return False |
|
|
return False |
|
|
|
|
|
|
|
|
_logger.debug(u"Call get_name_from_phone_number with number = %s" % number) |
|
|
|
|
|
# We try to match a phone or mobile number with the same end |
|
|
# We try to match a phone or mobile number with the same end |
|
|
pg_seach_number = '%' + number |
|
|
pg_seach_number = '%' + number |
|
|
res_ids = self.search(cr, uid, ['|', ('phone_e164', 'ilike', pg_seach_number), ('mobile_e164', 'ilike', pg_seach_number)], context=context) |
|
|
res_ids = self.search(cr, uid, ['|', ('phone_e164', 'ilike', pg_seach_number), ('mobile_e164', 'ilike', pg_seach_number)], context=context) |
|
|