Skip to content

Commit

Permalink
changed get_correspondence_attachment to always add the letter as an …
Browse files Browse the repository at this point in the history
…attachment, not sure about that one
  • Loading branch information
Prazn committed Aug 30, 2024
1 parent b97b08a commit 8c6757c
Showing 1 changed file with 16 additions and 17 deletions.
33 changes: 16 additions & 17 deletions partner_communication_compassion/models/partner_communication.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,23 +35,22 @@ def get_correspondence_attachments(self, letters=None):
report = "partner_communication.a4_communication"
if letters is None:
letters = self.get_objects()
if self.send_mode == "physical":
for letter in letters:
try:
attachments[letter.file_name] = [
report,
self._convert_pdf(letter.letter_image),
]
except MissingError:
_logger.warning("Missing letter image", exc_info=True)
self.send_mode = False
self.auto_send = False
self.message_post(
body=_("The letter image is missing!"),
subject=_("Missing letter"),
)
continue
else:
for letter in letters:
try:
attachments[letter.file_name] = [
report,
self._convert_pdf(letter.letter_image),
]
except MissingError:
_logger.warning("Missing letter image", exc_info=True)
self.send_mode = False
self.auto_send = False
self.message_post(
body=_("The letter image is missing!"),
subject=_("Missing letter"),
)
continue
if self.send_mode != "physical":
# Attach directly a zip in the letters
letters.attach_zip()
return attachments
Expand Down

0 comments on commit 8c6757c

Please sign in to comment.