diff --git a/addons/phone_validation/models/mail_thread_phone.py b/addons/phone_validation/models/mail_thread_phone.py index d560de1911a..7eacb84d5c6 100644 --- a/addons/phone_validation/models/mail_thread_phone.py +++ b/addons/phone_validation/models/mail_thread_phone.py @@ -63,15 +63,18 @@ class PhoneMixin(models.AbstractModel): number_fields = self._phone_get_number_fields() for record in self: record.phone_sanitized_blacklisted = record.phone_sanitized in blacklist + mobile_blacklisted = phone_blacklisted = False # This is a bit of a hack. Assume that any "mobile" numbers will have the word 'mobile' # in them due to varying field names and assume all others are just "phone" numbers. # Note that the limitation of only having 1 phone_sanitized value means that a phone/mobile number # may not be calculated as blacklisted even though it is if both field values exist in a model. for number_field in number_fields: if 'mobile' in number_field: - record.mobile_blacklisted = record.phone_sanitized_blacklisted and record.phone_get_sanitized_number(number_fname=number_field) == record.phone_sanitized + mobile_blacklisted = record.phone_sanitized_blacklisted and record.phone_get_sanitized_number(number_fname=number_field) == record.phone_sanitized else: - record.phone_blacklisted = record.phone_sanitized_blacklisted and record.phone_get_sanitized_number(number_fname=number_field) == record.phone_sanitized + phone_blacklisted = record.phone_sanitized_blacklisted and record.phone_get_sanitized_number(number_fname=number_field) == record.phone_sanitized + record.mobile_blacklisted = mobile_blacklisted + record.phone_blacklisted = phone_blacklisted @api.model def _search_phone_sanitized_blacklisted(self, operator, value):