[IMP] mail: turn 'FollowerSubtypeView/follower' into field

Task-2793280

closes odoo/odoo#87014

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
This commit is contained in:
Alexandre Kühn
2022-03-31 13:32:51 +02:00
parent 8d3a295426
commit 06595953c3
4 changed files with 7 additions and 15 deletions
@@ -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',
});
@@ -5,7 +5,7 @@
<t t-if="followerSubtypeView">
<div class="o_FollowerSubtype" t-attf-class="{{ className }}" t-att-data-local-id="followerSubtypeView.localId" t-ref="root">
<label class="o_FollowerSubtype_label">
<input class="o_FollowerSubtype_checkbox" type="checkbox" t-att-checked="follower.selectedSubtypes.includes(followerSubtypeView.subtype) ? 'checked': ''" t-on-change="_onChangeCheckbox"/>
<input class="o_FollowerSubtype_checkbox" type="checkbox" t-att-checked="followerSubtypeView.follower.selectedSubtypes.includes(followerSubtypeView.subtype) ? 'checked': ''" t-on-change="_onChangeCheckbox"/>
<t t-esc="followerSubtypeView.subtype.name"/>
</label>
</div>
@@ -17,7 +17,6 @@
<FollowerSubtype
className="'o_FollowerSubtypeList_subtype'"
localId="followerSubtypeView.localId"
followerLocalId="followerSubtypeList.follower.localId"
/>
</t>
</div>
@@ -7,6 +7,9 @@ registerModel({
name: 'FollowerSubtypeView',
identifyingFields: ['followerSubtypeListOwner', 'subtype'],
fields: {
follower: one('Follower', {
related: 'followerSubtypeListOwner.follower',
}),
followerSubtypeListOwner: one('FollowerSubtypeList', {
inverse: 'followerSubtypeViews',
readonly: true,