Skip to content

Commit

Permalink
[modules/party] party: Add missing depends [CUSTOM] (#6)
Browse files Browse the repository at this point in the history
Fix #PJAZZ-735
  • Loading branch information
JCavallo authored and nicoe committed Jul 7, 2023
1 parent a2db91b commit 1b2fab7
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions modules/party/contact_mechanism.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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)
Expand All @@ -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)
Expand Down

0 comments on commit 1b2fab7

Please sign in to comment.