From 10af1a949b52ae4a2a86e943ccf4b23a41ef4d92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Fri, 19 Feb 2021 11:49:38 +0000 Subject: [PATCH] [REF] mail: remove is_subscribed duplicated field on mail.channel RATIONALE Channel model is a mail.thread enabled model behaving strangely with followers, notifications and discuss. Its code should however be simplified to be more self contained and avoid unwanted side effects on other models. SPECIFICATION Channel holds two fields computing current user's membership on channel. ``is_subscribed`` is a duplicate of ``is_member``. It is therefore removed to keep a single field. LINKS Task ID-2070632 (main task) Task ID-2419762 (followup task) COM PR odoo/odoo#62859 ENT PR odoo/enterprise#15172 UPG PR odoo/upgrade#2005 --- addons/mail/models/mail_channel.py | 7 ------- addons/mail/views/mail_channel_views.xml | 6 +++--- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/addons/mail/models/mail_channel.py b/addons/mail/models/mail_channel.py index b7c692c2d4b..01086b19bdd 100644 --- a/addons/mail/models/mail_channel.py +++ b/addons/mail/models/mail_channel.py @@ -59,8 +59,6 @@ class Channel(models.Model): 'mail.message', 'mail_message_mail_channel_rel', string='Channel Messages') is_member = fields.Boolean('Is a member', compute='_compute_is_member') - is_subscribed = fields.Boolean( - 'Is Subscribed', compute='_compute_is_subscribed') group_ids = fields.Many2many( 'res.groups', string='Auto Subscription', help="Members of those groups will automatically added as followers. " @@ -107,11 +105,6 @@ class Channel(models.Model): for record in self: record.is_member = record in membership_ids - @api.depends('channel_partner_ids') - def _compute_is_subscribed(self): - for channel in self: - channel.is_subscribed = self.env.user.partner_id in channel.channel_partner_ids - @api.depends('moderator_ids') def _compute_is_moderator(self): for channel in self: diff --git a/addons/mail/views/mail_channel_views.xml b/addons/mail/views/mail_channel_views.xml index 9dff8955211..74fd97973f0 100644 --- a/addons/mail/views/mail_channel_views.xml +++ b/addons/mail/views/mail_channel_views.xml @@ -10,7 +10,7 @@ - + @@ -27,8 +27,8 @@

- - + +