summaryrefslogtreecommitdiff
path: root/addons/phone_validation/models/mail_thread_phone.py
diff options
context:
space:
mode:
Diffstat (limited to 'addons/phone_validation/models/mail_thread_phone.py')
-rw-r--r--addons/phone_validation/models/mail_thread_phone.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/addons/phone_validation/models/mail_thread_phone.py b/addons/phone_validation/models/mail_thread_phone.py
index 7eacb84d5c6..f81da543678 100644
--- a/addons/phone_validation/models/mail_thread_phone.py
+++ b/addons/phone_validation/models/mail_thread_phone.py
@@ -43,7 +43,7 @@ class PhoneMixin(models.AbstractModel):
help="Indicates if a blacklisted sanitized phone number is a mobile number. Helps distinguish which number is blacklisted \
when there is both a mobile and phone field in a model.")
- @api.depends(lambda self: self._phone_get_number_fields())
+ @api.depends(lambda self: self._phone_get_sanitize_triggers())
def _compute_phone_sanitized(self):
self._assert_phone_field()
number_fields = self._phone_get_number_fields()
@@ -113,6 +113,11 @@ class PhoneMixin(models.AbstractModel):
if not any(fname in self and self._fields[fname].type == 'char' for fname in self._phone_get_number_fields()):
raise UserError(_('Invalid primary phone field on model %s', self._name))
+ def _phone_get_sanitize_triggers(self):
+ """ Tool method to get all triggers for sanitize """
+ res = [self._phone_get_country_field()] if self._phone_get_country_field() else []
+ return res + self._phone_get_number_fields()
+
def _phone_get_number_fields(self):
""" This method returns the fields to use to find the number to use to
send an SMS on a record. """