Skip to content

Commit

Permalink
CP-163 FIX communication mode computation for SMS
Browse files Browse the repository at this point in the history
  • Loading branch information
ecino committed Oct 5, 2022
1 parent 888e279 commit 6723cf0
Showing 1 changed file with 15 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,17 +105,6 @@ def open_test_case_wizard(self):
'target': 'current',
}

def get_inform_mode(self, partner):
"""""
Force SMS sending for W&P sponsors.
"""
self.ensure_one()
send_mode, auto_mode = super().get_inform_mode(partner)
if partner.write_and_pray and partner.global_communication_delivery_preference == "sms"\
and send_mode == "digital" and partner.lang != "it_IT":
send_mode = "sms"
return send_mode, auto_mode

def _get_test_objects(self, partner, children=None):
if self.model == "res.partner":
object_ids = partner.ids
Expand Down Expand Up @@ -164,3 +153,18 @@ def _find_partner(self, number_sponsorships, lang, family_case):
# randomly select one
answer = random.choice(answers)
return answer

def _get_send_priority(self, partner, print_if_not_email):
# Tell what to do if partner has SMS set as communication preference
res = super()._get_send_priority(partner, print_if_not_email)
if partner.lang != "it_IT":
res["digital"]["sms"] = "sms"
res["digital_only"]["sms"] = "digital" if partner.email else "none"
res["both"]["sms"] = "sms"
return res

def _get_auto_mode(self, partner_mode, communication_mode):
if partner_mode == "sms":
return "auto" in communication_mode
else:
return super()._get_auto_mode(partner_mode, communication_mode)

0 comments on commit 6723cf0

Please sign in to comment.