From c4879edbddf3ca9076be47cc9e6d3197030d06c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Mon, 21 Dec 2020 09:52:12 +0000 Subject: [PATCH] [FIX] mail: fix is_chat compute method and triggers SPECIFICATIONS is_chat triggers are missing and default value should not be defined on a computed field. LINKS Task ID-2421795 COM PR odoo/odoo#63677 X-original-commit: ff4a0ec9042ad43bb8781ed60b880d3c53f5063d --- addons/mail/models/mail_channel.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/addons/mail/models/mail_channel.py b/addons/mail/models/mail_channel.py index d8ce2226c9e..fbe2eada7c5 100644 --- a/addons/mail/models/mail_channel.py +++ b/addons/mail/models/mail_channel.py @@ -80,7 +80,7 @@ class Channel(models.Model): ('chat', 'Chat Discussion'), ('channel', 'Channel')], 'Channel Type', default='channel') - is_chat = fields.Boolean(string='Is a chat', compute='_compute_is_chat', default=False) + is_chat = fields.Boolean(string='Is a chat', compute='_compute_is_chat') description = fields.Text('Description') uuid = fields.Char('UUID', size=50, index=True, default=lambda self: str(uuid4()), copy=False) email_send = fields.Boolean('Send messages by email', default=False) @@ -169,12 +169,10 @@ class Channel(models.Model): for record in self: record.is_member = record in membership_ids + @api.depends('channel_type') def _compute_is_chat(self): for record in self: - if record.channel_type == 'chat': - record.is_chat = True - else: - record.is_chat = False + record.is_chat = record.channel_type == 'chat' @api.onchange('public') def _onchange_public(self):