Skip to content

Commit

Permalink
[FIX] helpdesk_mgmt: format partner_email when receive it from new me…
Browse files Browse the repository at this point in the history
…ssage

from mail gateway

Fill partner_name if partner_id not found
  • Loading branch information
mathben committed Jul 24, 2023
1 parent 7f7adf7 commit 69cb878
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
7 changes: 6 additions & 1 deletion helpdesk_mgmt/models/helpdesk_ticket.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,12 +213,17 @@ def message_new(self, msg, custom_values=None):
"""
if custom_values is None:
custom_values = {}
partner_name, partner_email = next(
iter(tools.email_split_tuples(msg.get("from"))), ("", "")
)
defaults = {
"name": msg.get("subject") or _("No Subject"),
"description": msg.get("body"),
"partner_email": msg.get("from"),
"partner_email": partner_email,
"partner_id": msg.get("author_id"),
}
if not msg.get("author_id"):
defaults["partner_name"] = partner_name
defaults.update(custom_values)

# Write default values coming from msg
Expand Down
1 change: 1 addition & 0 deletions helpdesk_mgmt/tests/test_helpdesk_ticket.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ def test_helpdesk_ticket_message_new(self):
"message_id": msg_id,
"subject": title,
"email_from": "Bob <bob@example.com>",
"from": "Bob <bob@example.com>",
"to": "jill@example.com",
"cc": "sally@example.com",
"recipients": "jill@example.com+sally@example.com",
Expand Down

0 comments on commit 69cb878

Please sign in to comment.