Skip to content

Commit

Permalink
[REF] l10n_it_fatturapa_pec: refactoring clean_messages_dict and avoi…
Browse files Browse the repository at this point in the history
…d error if key not exist
  • Loading branch information
micheledic authored and tafaRU committed Jan 10, 2025
1 parent 7859cf1 commit 288d511
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions l10n_it_fatturapa_pec/models/mail_thread.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,22 @@ class MailThread(models.AbstractModel):
_inherit = "mail.thread"

def clean_message_dict(self, message_dict):
del message_dict["attachments"]
del message_dict["cc"]
del message_dict["from"]
del message_dict["to"]
del message_dict["recipients"]
del message_dict["references"]
del message_dict["in_reply_to"]
del message_dict["bounced_email"]
del message_dict["bounced_partner"]
del message_dict["bounced_msg_id"]
del message_dict["bounced_message"]
fields_to_clean = [
"attachments",
"cc",
"from",
"to",
"recipients",
"references",
"in_reply_to",
"bounced_email",
"bounced_partner",
"bounced_msg_id",
"bounced_message",
"x_odoo_message_id",
]
for field in fields_to_clean:
message_dict.pop(field, None)

@api.model
def message_route(
Expand Down

0 comments on commit 288d511

Please sign in to comment.