Skip to content

Commit

Permalink
CO-3775 Prevent sending onboarding card for partners to verify
Browse files Browse the repository at this point in the history
  • Loading branch information
ecino committed Sep 14, 2021
1 parent ae22deb commit 2639f12
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions partner_communication_switzerland/models/partner_communication.py
Expand Up @@ -527,6 +527,21 @@ def send(self):
" before printing the communication."
)
)

# Prevent sending onboarding card when partner is not validated
onboarding_new_donor = self.env.ref(
"partner_communication_switzerland"
".config_new_donors_onboarding_postcard_and_magazine")
verify = self.env.ref("cms_form_compassion.activity_check_duplicates")
blocking = other_jobs.filtered(
lambda j: j.config_id == onboarding_new_donor
and j.partner_id.activity_ids.filtered(
lambda a: a.activity_type_id == verify))
if blocking:
raise UserError(_(
"You cannot send the onboarding postcard when the partner is not "
"verified. Please check the following partners: %s"
) % ",".join(blocking.mapped("partner_id.name")))
super(PartnerCommunication, other_jobs).send()

# No money extension
Expand Down

0 comments on commit 2639f12

Please sign in to comment.