Skip to content

Commit

Permalink
[IMP] Avoid duplicate sendings in mass communications
Browse files Browse the repository at this point in the history
  • Loading branch information
ecino committed Sep 17, 2024
1 parent 7d252e8 commit ac4a514
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
10 changes: 10 additions & 0 deletions partner_communication/wizards/generate_communication_wizard.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,17 @@ def close(self):

def generate_communications(self, async_mode=True):
"""Create the communication records"""
processed_addresses = set()
send_mode = self.send_mode or self.model_id.send_mode
for partner in self.partner_ids:
address = (
partner.email
if "digital" in send_mode
else f"{partner.zip} {partner.city}"
)
if address in processed_addresses:
continue
processed_addresses.add(address)
vals = {
"partner_id": partner.id,
"object_ids": partner.id,
Expand Down
3 changes: 1 addition & 2 deletions sbc_compassion/models/correspondence.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,8 +234,7 @@ class Correspondence(models.Model):
# Letter remote access
######################
uuid = fields.Char(
required=True, default=lambda self: self._get_uuid(),
copy=False, index=True
required=True, default=lambda self: self._get_uuid(), copy=False, index=True
)
read_url = fields.Char(compute="_compute_read_url", store=True)

Expand Down

0 comments on commit ac4a514

Please sign in to comment.