From 1cff7104c329b7e1b3b4f045cdf6a8eec5c92512 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Thu, 17 Dec 2020 13:00:42 +0000 Subject: [PATCH] [REF] mail: remove now unused channel_id field on invite 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. SPECIFICATIONS Remove ``channel_id`` field from ``mail.invite.wizard``. As we removed support of (un)subscribing channel-based followers there is no need anymore to have a field to add them in invite wizard. We can now safely remove this field as it has no use anymore. 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 --- .../follower_list_menu/follower_list_menu_tests.js | 4 ---- addons/mail/static/src/models/thread/thread.js | 7 ++----- addons/mail/wizard/invite.py | 4 ---- addons/mail/wizard/invite_view.xml | 9 ++------- 4 files changed, 4 insertions(+), 20 deletions(-) diff --git a/addons/mail/static/src/components/follower_list_menu/follower_list_menu_tests.js b/addons/mail/static/src/components/follower_list_menu/follower_list_menu_tests.js index 06a4634dbee..d277bca15da 100644 --- a/addons/mail/static/src/components/follower_list_menu/follower_list_menu_tests.js +++ b/addons/mail/static/src/components/follower_list_menu/follower_list_menu_tests.js @@ -130,10 +130,6 @@ QUnit.test('click on "add followers" button', async function (assert) { 'res.partner', "'The 'add followers' action should contain thread model in context'" ); - assert.notOk( - payload.action.context.mail_invite_follower_channel_only, - "The 'add followers' action should not be restricted to channels only" - ); assert.strictEqual( payload.action.context.default_res_id, 100, diff --git a/addons/mail/static/src/models/thread/thread.js b/addons/mail/static/src/models/thread/thread.js index 93d9fd52f32..6b2c68f06ec 100644 --- a/addons/mail/static/src/models/thread/thread.js +++ b/addons/mail/static/src/models/thread/thread.js @@ -755,7 +755,7 @@ function factory(dependencies) { * Open a dialog to add partners as followers. */ promptAddPartnerFollower() { - this._promptAddFollower({ mail_invite_follower_channel_only: false }); + this._promptAddFollower(); } async refresh() { @@ -1523,10 +1523,8 @@ function factory(dependencies) { /** * @private - * @param {Object} [param0={}] - * @param {boolean} [param0.mail_invite_follower_channel_only=false] */ - _promptAddFollower({ mail_invite_follower_channel_only = false } = {}) { + _promptAddFollower() { const action = { type: 'ir.actions.act_window', res_model: 'mail.wizard.invite', @@ -1537,7 +1535,6 @@ function factory(dependencies) { context: { default_res_model: this.model, default_res_id: this.id, - mail_invite_follower_channel_only, }, }; this.env.bus.trigger('do-action', { diff --git a/addons/mail/wizard/invite.py b/addons/mail/wizard/invite.py index 28741997df6..229fa65d99f 100644 --- a/addons/mail/wizard/invite.py +++ b/addons/mail/wizard/invite.py @@ -16,8 +16,6 @@ class Invite(models.TransientModel): @api.model def default_get(self, fields): result = super(Invite, self).default_get(fields) - if self._context.get('mail_invite_follower_channel_only'): - result['send_mail'] = False if 'message' not in fields: return result @@ -42,8 +40,6 @@ class Invite(models.TransientModel): res_model = fields.Char('Related Document Model', required=True, index=True, help='Model of the followed resource') res_id = fields.Integer('Related Document ID', index=True, help='Id of the followed resource') partner_ids = fields.Many2many('res.partner', string='Recipients', help="List of partners that will be added as follower of the current document.") - channel_ids = fields.Many2many('mail.channel', string='Channels', help='List of channels that will be added as listeners of the current document.', - domain=[('channel_type', '=', 'channel')]) message = fields.Html('Message') send_mail = fields.Boolean('Send Email', default=True, help="If checked, the partners will receive an email warning they have been added in the document's followers.") diff --git a/addons/mail/wizard/invite_view.xml b/addons/mail/wizard/invite_view.xml index aa8633d225d..9b35c27ed16 100644 --- a/addons/mail/wizard/invite_view.xml +++ b/addons/mail/wizard/invite_view.xml @@ -13,13 +13,8 @@ - - + context="{'force_email':True, 'show_email':True}"/> +