From c2f5039f84e74de98ca6374b64f52cd47cc61f2a Mon Sep 17 00:00:00 2001 From: Nicolas Lempereur <nle@odoo.com> Date: Mon, 2 Oct 2017 15:32:22 +0200 Subject: [PATCH] [FIX] mail: error if called in onchange of virtual This field can be called on an hr.expense for onchange on an hr.expense.sheet record, thus the recordset could be a virtual ID so self.ids could be empty leading to an error. --- addons/mail/models/mail_thread.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/mail/models/mail_thread.py b/addons/mail/models/mail_thread.py index 15b3cdee6df2..d383c8096ea9 100644 --- a/addons/mail/models/mail_thread.py +++ b/addons/mail/models/mail_thread.py @@ -180,7 +180,7 @@ class MailThread(models.AbstractModel): WHERE msg.model = %s AND msg.res_id in %s AND (msg.author_id IS NULL OR msg.author_id != %s) AND (msg.message_type != 'notification' OR msg.model != 'mail.channel')""", - (partner_id, self._name, tuple(self.ids), partner_id,)) + (partner_id, self._name, tuple(self.ids) or (None,), partner_id,)) for result in self._cr.fetchall(): res[result[0]] += 1 -- GitLab