From e524a2500448ff9a1cfcc8765601754f7ae6180c Mon Sep 17 00:00:00 2001 From: Jalpesh Patel Date: Thu, 4 Apr 2019 13:18:17 +0000 Subject: [PATCH] [FIX] digest: fix m2m typo that would not do whats expected MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit m2m ORM operation (4, id, _) was not correctly used, resulting in an unexpected behavior. Instead of adding the record, it would add the record and also the res.user(4,). As that used is generally the public user, without an email address, that bug would not be that critical but if that res.user(4,) does not exist (eg deleted), then the code simply crash as it tries to read user 4 from db. closes odoo/odoo#32425 Signed-off-by: Jérémy Kersten (jke) --- addons/digest/models/digest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/digest/models/digest.py b/addons/digest/models/digest.py index 1283a5a241c..b3fd27a6284 100644 --- a/addons/digest/models/digest.py +++ b/addons/digest/models/digest.py @@ -133,7 +133,7 @@ class Digest(models.Model): tip = self.env['digest.tip'].search([('user_ids', '!=', user.id), '|', ('group_id', 'in', user.groups_id.ids), ('group_id', '=', False)], limit=1) if not tip: return False - tip.user_ids = [4, user.id] + tip.user_ids += user body = tools.html_sanitize(tip.tip_description) tip_description = self.env['mail.template']._render_template(body, 'digest.tip', self.id) return tip_description