diff --git a/modules/party/contact_mechanism.py b/modules/party/contact_mechanism.py index 64da90d810..319c4ca2a1 100644 --- a/modules/party/contact_mechanism.py +++ b/modules/party/contact_mechanism.py @@ -178,7 +178,8 @@ def _phone_country_codes(self): if address.country: yield address.country.code - @fields.depends(methods=['_phone_country_codes']) + @fields.depends('party', '_parent_party.addresses', + methods=['_phone_country_codes']) def _parse_phonenumber(self, value): for country_code in chain(self._phone_country_codes(), [None]): try: @@ -191,7 +192,8 @@ def _parse_phonenumber(self, value): return phonenumber return None - @fields.depends(methods=['_parse_phonenumber']) + @fields.depends('party', '_parent_party.addresses', + methods=['_parse_phonenumber']) def format_value(self, value=None, type_=None): if phonenumbers and type_ in _PHONE_TYPES: phonenumber = self._parse_phonenumber(value) @@ -200,7 +202,8 @@ def format_value(self, value=None, type_=None): phonenumber, PhoneNumberFormat.INTERNATIONAL) return value - @fields.depends(methods=['_parse_phonenumber']) + @fields.depends('party', '_parent_party.addresses', + methods=['_parse_phonenumber']) def format_value_compact(self, value=None, type_=None): if phonenumbers and type_ in _PHONE_TYPES: phonenumber = self._parse_phonenumber(value)