[FIX] mail: Sending a sms on an opportunity without customer

Steps to reproduce the bug:

- Create an opportunity without a customer but with a phone number
- Send a sms
- Refesh the page

Bug:

A traceback was raised because an entry is created in mail_message_res_partner_needaction_rel
with partner_id = False

Due to https://github.com/odoo/odoo/blob/14.0/addons/sms/models/mail_thread.py#L327

A mail.notification is created from a sms even if there is no partner set on the sms

opw:2372201

closes odoo/odoo#61425

X-original-commit: 651da2fe8694ed0003a9dd0801c71f2ef26cedb9
Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
This commit is contained in:
Goffin Simon
2020-11-05 14:58:13 +00:00
parent 0658995624
commit 4ea3e31816
+1 -1
View File
@@ -100,5 +100,5 @@ class MailNotification(models.Model):
'notification_type': notif.notification_type,
'notification_status': notif.notification_status,
'failure_type': notif.failure_type,
'res_partner_id': [notif.res_partner_id.id, notif.res_partner_id.display_name],
'res_partner_id': [notif.res_partner_id.id, notif.res_partner_id.display_name] if notif.res_partner_id else False,
} for notif in self]