From 06595953c39f74c87acfac7ea1d47876ac0f90b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandre=20K=C3=BChn?= Date: Tue, 22 Mar 2022 17:48:15 +0000 Subject: [PATCH] [IMP] mail: turn 'FollowerSubtypeView/follower' into field MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task-2793280 closes odoo/odoo#87014 Signed-off-by: Alexandre Kühn (aku) --- .../follower_subtype/follower_subtype.js | 16 +++------------- .../follower_subtype/follower_subtype.xml | 2 +- .../follower_subtype_list.xml | 1 - .../static/src/models/follower_subtype_view.js | 3 +++ 4 files changed, 7 insertions(+), 15 deletions(-) diff --git a/addons/mail/static/src/components/follower_subtype/follower_subtype.js b/addons/mail/static/src/components/follower_subtype/follower_subtype.js index 2009a4fa3b0..71a0cc98ce1 100644 --- a/addons/mail/static/src/components/follower_subtype/follower_subtype.js +++ b/addons/mail/static/src/components/follower_subtype/follower_subtype.js @@ -10,13 +10,6 @@ export class FollowerSubtype extends Component { // Public //-------------------------------------------------------------------------- - /** - * @returns {Follower|undefined} - */ - get follower() { - return this.messaging && this.messaging.models['Follower'].get(this.props.followerLocalId); - } - /** * @returns {FollowerSubtypeView} */ @@ -36,19 +29,16 @@ export class FollowerSubtype extends Component { */ _onChangeCheckbox(ev) { if (ev.target.checked) { - this.follower.selectSubtype(this.followerSubtypeView.subtype); + this.followerSubtypeView.follower.selectSubtype(this.followerSubtypeView.subtype); } else { - this.follower.unselectSubtype(this.followerSubtypeView.subtype); + this.followerSubtypeView.follower.unselectSubtype(this.followerSubtypeView.subtype); } } } Object.assign(FollowerSubtype, { - props: { - followerLocalId: String, - localId: String, - }, + props: { localId: String }, template: 'mail.FollowerSubtype', }); diff --git a/addons/mail/static/src/components/follower_subtype/follower_subtype.xml b/addons/mail/static/src/components/follower_subtype/follower_subtype.xml index d99edc4ed1a..2923a7ebe8a 100644 --- a/addons/mail/static/src/components/follower_subtype/follower_subtype.xml +++ b/addons/mail/static/src/components/follower_subtype/follower_subtype.xml @@ -5,7 +5,7 @@
diff --git a/addons/mail/static/src/components/follower_subtype_list/follower_subtype_list.xml b/addons/mail/static/src/components/follower_subtype_list/follower_subtype_list.xml index cf814885081..7e0bb7eb57f 100644 --- a/addons/mail/static/src/components/follower_subtype_list/follower_subtype_list.xml +++ b/addons/mail/static/src/components/follower_subtype_list/follower_subtype_list.xml @@ -17,7 +17,6 @@
diff --git a/addons/mail/static/src/models/follower_subtype_view.js b/addons/mail/static/src/models/follower_subtype_view.js index 96e7d9490b2..208058f11f9 100644 --- a/addons/mail/static/src/models/follower_subtype_view.js +++ b/addons/mail/static/src/models/follower_subtype_view.js @@ -7,6 +7,9 @@ registerModel({ name: 'FollowerSubtypeView', identifyingFields: ['followerSubtypeListOwner', 'subtype'], fields: { + follower: one('Follower', { + related: 'followerSubtypeListOwner.follower', + }), followerSubtypeListOwner: one('FollowerSubtypeList', { inverse: 'followerSubtypeViews', readonly: true,