diff --git a/addons/hr_holidays/static/tests/qunit_suite_tests/components/partner_im_status_icon_tests.js b/addons/hr_holidays/static/tests/qunit_suite_tests/components/partner_im_status_icon_tests.js
index 3b0d4c1efd3..2c2a19cc3f3 100644
--- a/addons/hr_holidays/static/tests/qunit_suite_tests/components/partner_im_status_icon_tests.js
+++ b/addons/hr_holidays/static/tests/qunit_suite_tests/components/partner_im_status_icon_tests.js
@@ -11,7 +11,7 @@ QUnit.module('partner_im_status_icon_tests.js', {
beforeEach() {
this.createPartnerImStatusIcon = async (partner, target) => {
await createRootMessagingComponent(partner.env, "PartnerImStatusIcon", {
- props: { partnerLocalId: partner.localId },
+ props: { partner },
target,
});
};
diff --git a/addons/hr_holidays/static/tests/qunit_suite_tests/components/thread_icon_tests.js b/addons/hr_holidays/static/tests/qunit_suite_tests/components/thread_icon_tests.js
index 88ef3e5b9ee..25d48966ad2 100644
--- a/addons/hr_holidays/static/tests/qunit_suite_tests/components/thread_icon_tests.js
+++ b/addons/hr_holidays/static/tests/qunit_suite_tests/components/thread_icon_tests.js
@@ -12,7 +12,7 @@ QUnit.module('thread_icon_tests.js', {
beforeEach() {
this.createThreadIcon = async (thread, target) => {
await createRootMessagingComponent(thread.env, "ThreadIcon", {
- props: { threadLocalId: thread.localId },
+ props: { thread },
target,
});
};
diff --git a/addons/im_livechat/static/src/components/discuss_sidebar/discuss_sidebar.xml b/addons/im_livechat/static/src/components/discuss_sidebar/discuss_sidebar.xml
index 7a2e00d50f1..a73693498c7 100644
--- a/addons/im_livechat/static/src/components/discuss_sidebar/discuss_sidebar.xml
+++ b/addons/im_livechat/static/src/components/discuss_sidebar/discuss_sidebar.xml
@@ -6,7 +6,7 @@
diff --git a/addons/im_livechat/static/tests/qunit_suite_tests/components/thread_icon_tests.js b/addons/im_livechat/static/tests/qunit_suite_tests/components/thread_icon_tests.js
index fb38a8dd4db..3ddc16cb479 100644
--- a/addons/im_livechat/static/tests/qunit_suite_tests/components/thread_icon_tests.js
+++ b/addons/im_livechat/static/tests/qunit_suite_tests/components/thread_icon_tests.js
@@ -13,7 +13,7 @@ QUnit.module('thread_icon_tests.js', {
beforeEach() {
this.createThreadIcon = async (thread, target) => {
await createRootMessagingComponent(thread.env, "ThreadIcon", {
- props: { threadLocalId: thread.localId },
+ props: { thread },
target,
});
};
diff --git a/addons/im_livechat/static/tests/qunit_suite_tests/components/thread_textual_typing_status_tests.js b/addons/im_livechat/static/tests/qunit_suite_tests/components/thread_textual_typing_status_tests.js
index 6d3a510a61a..63db06d1480 100644
--- a/addons/im_livechat/static/tests/qunit_suite_tests/components/thread_textual_typing_status_tests.js
+++ b/addons/im_livechat/static/tests/qunit_suite_tests/components/thread_textual_typing_status_tests.js
@@ -13,7 +13,7 @@ QUnit.module('thread_textual_typing_status_tests.js', {
beforeEach() {
this.createThreadTextualTypingStatusComponent = async (thread, target) => {
await createRootMessagingComponent(thread.env, "ThreadTextualTypingStatus", {
- props: { threadLocalId: thread.localId },
+ props: { thread },
target,
});
};
diff --git a/addons/mail/static/src/component_hooks/use_component_to_model.js b/addons/mail/static/src/component_hooks/use_component_to_model.js
index 2b9eee17fee..12af5a3caf3 100644
--- a/addons/mail/static/src/component_hooks/use_component_to_model.js
+++ b/addons/mail/static/src/component_hooks/use_component_to_model.js
@@ -2,7 +2,7 @@
import { clear } from '@mail/model/model_field_command';
-const { onWillDestroy, onWillUpdateProps, useComponent } = owl;
+const { onWillUpdateProps, useComponent } = owl;
/**
* This hook provides support for saving the reference of the component directly
@@ -11,29 +11,16 @@ const { onWillDestroy, onWillUpdateProps, useComponent } = owl;
*
* @param {Object} param0
* @param {string} param0.fieldName Name of the field on the target record.
- * @param {string} param0.modelName Name of the model of the target record.
*/
-export function useComponentToModel({ fieldName, modelName }) {
+export function useComponentToModel({ fieldName }) {
const component = useComponent();
- const { modelManager } = component.env.services.messaging;
- const record = modelManager.models[modelName].get(component.props.localId);
- if (record) {
- record.update({ [fieldName]: component });
- }
+ component.props.record.update({ [fieldName]: component });
onWillUpdateProps(nextProps => {
- const currentRecord = modelManager.models[modelName].get(component.props.localId);
- const nextRecord = modelManager.models[modelName].get(nextProps.localId);
- if (currentRecord && currentRecord !== nextRecord) {
+ const currentRecord = component.props.record;
+ const nextRecord = nextProps.record;
+ if (currentRecord.exists() && currentRecord !== nextRecord) {
currentRecord.update({ [fieldName]: clear() });
}
- if (nextRecord) {
- nextRecord.update({ [fieldName]: component });
- }
- });
- onWillDestroy(() => {
- const record = modelManager.models[modelName].get(component.props.localId);
- if (record) {
- record.update({ [fieldName]: clear() });
- }
+ nextRecord.update({ [fieldName]: component });
});
}
diff --git a/addons/mail/static/src/component_hooks/use_ref_to_model.js b/addons/mail/static/src/component_hooks/use_ref_to_model.js
index b841c243007..bc969345a70 100644
--- a/addons/mail/static/src/component_hooks/use_ref_to_model.js
+++ b/addons/mail/static/src/component_hooks/use_ref_to_model.js
@@ -2,7 +2,7 @@
import { clear } from '@mail/model/model_field_command';
-const { onWillDestroy, onWillUpdateProps, useComponent, useRef } = owl;
+const { onWillUpdateProps, useComponent, useRef } = owl;
/**
* This hook provides support for saving the result of useRef directly into the
@@ -11,31 +11,18 @@ const { onWillDestroy, onWillUpdateProps, useComponent, useRef } = owl;
*
* @param {Object} param0
* @param {string} param0.fieldName Name of the field on the target record.
- * @param {string} param0.modelName Name of the model of the target record.
* @param {string} param0.refName Name of the t-ref on this component.
*/
-export function useRefToModel({ fieldName, modelName, refName }) {
+export function useRefToModel({ fieldName, refName }) {
const component = useComponent();
- const { modelManager } = component.env.services.messaging;
- const record = modelManager.models[modelName].get(component.props.localId);
const ref = useRef(refName);
- if (record) {
- record.update({ [fieldName]: ref });
- }
+ component.props.record.update({ [fieldName]: ref });
onWillUpdateProps(nextProps => {
- const currentRecord = modelManager.models[modelName].get(component.props.localId);
- const nextRecord = modelManager.models[modelName].get(nextProps.localId);
- if (currentRecord && currentRecord !== nextRecord) {
+ const currentRecord = component.props.record;
+ const nextRecord = nextProps.record;
+ if (currentRecord.exists() && currentRecord !== nextRecord) {
currentRecord.update({ [fieldName]: clear() });
}
- if (nextRecord) {
- nextRecord.update({ [fieldName]: ref });
- }
- });
- onWillDestroy(() => {
- const record = modelManager.models[modelName].get(component.props.localId);
- if (record) {
- record.update({ [fieldName]: clear() });
- }
+ nextRecord.update({ [fieldName]: ref });
});
}
diff --git a/addons/mail/static/src/component_hooks/use_update_to_model.js b/addons/mail/static/src/component_hooks/use_update_to_model.js
index 293be17f333..0a06f16cbd2 100644
--- a/addons/mail/static/src/component_hooks/use_update_to_model.js
+++ b/addons/mail/static/src/component_hooks/use_update_to_model.js
@@ -10,14 +10,10 @@ const { useComponent } = owl;
*
* @param {Object} param0
* @param {string} param0.methodName Name of the method on the target record.
- * @param {string} param0.modelName Name of the model of the target record.
*/
-export function useUpdateToModel({ methodName, modelName }) {
+export function useUpdateToModel({ methodName }) {
const component = useComponent();
useUpdate({ func: () => {
- const record = component.env.services.messaging.modelManager.models[modelName].get(component.props.localId);
- if (record) {
- record[methodName]();
- }
+ component.props.record[methodName]();
} });
}
diff --git a/addons/mail/static/src/components/activity/activity.js b/addons/mail/static/src/components/activity/activity.js
index f947f2af1fd..fb06f7734f7 100644
--- a/addons/mail/static/src/components/activity/activity.js
+++ b/addons/mail/static/src/components/activity/activity.js
@@ -14,21 +14,21 @@ export class Activity extends LegacyComponent {
*/
setup() {
super.setup();
- useComponentToModel({ fieldName: 'component', modelName: 'ActivityView' });
- useRefToModel({ fieldName: 'markDoneButtonRef', modelName: 'ActivityView', refName: 'markDoneButton', });
+ useComponentToModel({ fieldName: 'component' });
+ useRefToModel({ fieldName: 'markDoneButtonRef', refName: 'markDoneButton', });
}
/**
* @returns {ActivityView}
*/
get activityView() {
- return this.messaging && this.messaging.models['ActivityView'].get(this.props.localId);
+ return this.props.record;
}
}
Object.assign(Activity, {
- props: { localId: String },
+ props: { record: Object },
template: 'mail.Activity',
components: { Popover },
});
diff --git a/addons/mail/static/src/components/activity/activity.xml b/addons/mail/static/src/components/activity/activity.xml
index 1b0a2b9d914..a007ceb04f1 100644
--- a/addons/mail/static/src/components/activity/activity.xml
+++ b/addons/mail/static/src/components/activity/activity.xml
@@ -111,7 +111,7 @@
@@ -122,7 +122,7 @@
-
+
diff --git a/addons/mail/static/src/components/channel_invitation_form_selected_partner/channel_invitation_form_selected_partner.js b/addons/mail/static/src/components/channel_invitation_form_selected_partner/channel_invitation_form_selected_partner.js
index 7764aafbb70..1a304717139 100644
--- a/addons/mail/static/src/components/channel_invitation_form_selected_partner/channel_invitation_form_selected_partner.js
+++ b/addons/mail/static/src/components/channel_invitation_form_selected_partner/channel_invitation_form_selected_partner.js
@@ -10,22 +10,22 @@ export class ChannelInvitationFormSelectedPartner extends Component {
* @returns {ChannelInvitationForm}
*/
get channelInvitationForm() {
- return this.messaging && this.messaging.models['ChannelInvitationForm'].get(this.props.channelInvitationFormLocalId);
+ return this.props.channelInvitationForm;
}
/**
* @returns {Partner}
*/
get selectedPartner() {
- return this.messaging && this.messaging.models['Partner'].get(this.props.selectedPartnerLocalId);
+ return this.props.selectedPartner;
}
}
Object.assign(ChannelInvitationFormSelectedPartner, {
props: {
- channelInvitationFormLocalId: String,
- selectedPartnerLocalId: String,
+ channelInvitationForm: Object,
+ selectedPartner: Object,
},
template: 'mail.ChannelInvitationFormSelectedPartner',
});
diff --git a/addons/mail/static/src/components/channel_member/channel_member.js b/addons/mail/static/src/components/channel_member/channel_member.js
index d8274fa6cf6..20067057030 100644
--- a/addons/mail/static/src/components/channel_member/channel_member.js
+++ b/addons/mail/static/src/components/channel_member/channel_member.js
@@ -10,22 +10,22 @@ export class ChannelMember extends Component {
* @returns {Thread}
*/
get channel() {
- return this.messaging.models['Thread'].get(this.props.channelLocalId);
+ return this.props.channel;
}
/**
* @returns {Partner}
*/
get member() {
- return this.messaging.models['Partner'].get(this.props.memberLocalId);
+ return this.props.member;
}
}
Object.assign(ChannelMember, {
props: {
- channelLocalId: String,
- memberLocalId: String,
+ channel: Object,
+ member: Object,
},
template: 'mail.ChannelMember',
});
diff --git a/addons/mail/static/src/components/channel_member/channel_member.xml b/addons/mail/static/src/components/channel_member/channel_member.xml
index 3e50dea2c58..4f1f7ca3130 100644
--- a/addons/mail/static/src/components/channel_member/channel_member.xml
+++ b/addons/mail/static/src/components/channel_member/channel_member.xml
@@ -13,7 +13,7 @@
'o-isDeviceSmall': messaging.device.isSmall,
'small': !messaging.device.isSmall,
}"
- partnerLocalId="member.localId"
+ partner="member"
/>
diff --git a/addons/mail/static/src/components/channel_member_list/channel_member_list.js b/addons/mail/static/src/components/channel_member_list/channel_member_list.js
index d0c13536b81..23538762039 100644
--- a/addons/mail/static/src/components/channel_member_list/channel_member_list.js
+++ b/addons/mail/static/src/components/channel_member_list/channel_member_list.js
@@ -10,13 +10,13 @@ export class ChannelMemberList extends Component {
* @returns {ChannelMemberListView}
*/
get channelMemberListView() {
- return this.messaging && this.messaging.models['ChannelMemberListView'].get(this.props.localId);
+ return this.props.record;
}
}
Object.assign(ChannelMemberList, {
- props: { localId: String },
+ props: { record: Object },
template: 'mail.ChannelMemberList',
});
diff --git a/addons/mail/static/src/components/channel_member_list/channel_member_list.xml b/addons/mail/static/src/components/channel_member_list/channel_member_list.xml
index e24d49d7c1e..767f53667e1 100644
--- a/addons/mail/static/src/components/channel_member_list/channel_member_list.xml
+++ b/addons/mail/static/src/components/channel_member_list/channel_member_list.xml
@@ -34,7 +34,7 @@
-
-
+
diff --git a/addons/mail/static/src/components/chat_window/chat_window.js b/addons/mail/static/src/components/chat_window/chat_window.js
index 7940cadf10f..2d1e560eb5c 100644
--- a/addons/mail/static/src/components/chat_window/chat_window.js
+++ b/addons/mail/static/src/components/chat_window/chat_window.js
@@ -30,7 +30,7 @@ export class ChatWindow extends Component {
* @returns {ChatWindow}
*/
get chatWindow() {
- return this.messaging && this.messaging.models['ChatWindow'].get(this.props.localId);
+ return this.props.record;
}
//--------------------------------------------------------------------------
@@ -59,7 +59,7 @@ export class ChatWindow extends Component {
}
Object.assign(ChatWindow, {
- props: { localId: String },
+ props: { record: Object },
template: 'mail.ChatWindow',
});
diff --git a/addons/mail/static/src/components/chat_window/chat_window.xml b/addons/mail/static/src/components/chat_window/chat_window.xml
index 20fa6270c34..a82e0d31a17 100644
--- a/addons/mail/static/src/components/chat_window/chat_window.xml
+++ b/addons/mail/static/src/components/chat_window/chat_window.xml
@@ -15,20 +15,20 @@
>
-
+
-
+
@@ -38,7 +38,7 @@
diff --git a/addons/mail/static/src/components/chat_window_hidden_menu_item/chat_window_hidden_menu_item.js b/addons/mail/static/src/components/chat_window_hidden_menu_item/chat_window_hidden_menu_item.js
index a8ac8d809ab..2a0c6797d14 100644
--- a/addons/mail/static/src/components/chat_window_hidden_menu_item/chat_window_hidden_menu_item.js
+++ b/addons/mail/static/src/components/chat_window_hidden_menu_item/chat_window_hidden_menu_item.js
@@ -10,7 +10,7 @@ export class ChatWindowHiddenMenuItem extends Component {
* @returns {ChatWindowHeaderView}
*/
get chatWindowHeaderView() {
- return this.messaging && this.messaging.models['ChatWindowHeaderView'].get(this.props.chatWindowHeaderViewLocalId);
+ return this.props.chatWindowHeaderView;
}
}
@@ -19,7 +19,7 @@ Object.assign(ChatWindowHiddenMenuItem, {
isLast: false,
},
props: {
- chatWindowHeaderViewLocalId: String,
+ chatWindowHeaderView: Object,
isLast: {
type: Boolean,
optional: true,
diff --git a/addons/mail/static/src/components/chat_window_hidden_menu_item/chat_window_hidden_menu_item.xml b/addons/mail/static/src/components/chat_window_hidden_menu_item/chat_window_hidden_menu_item.xml
index a4b40634498..a5e33bffe88 100644
--- a/addons/mail/static/src/components/chat_window_hidden_menu_item/chat_window_hidden_menu_item.xml
+++ b/addons/mail/static/src/components/chat_window_hidden_menu_item/chat_window_hidden_menu_item.xml
@@ -5,8 +5,8 @@
diff --git a/addons/mail/static/src/components/chat_window_manager/chat_window_manager.xml b/addons/mail/static/src/components/chat_window_manager/chat_window_manager.xml
index e6cd82f9ad3..23a53d895a6 100644
--- a/addons/mail/static/src/components/chat_window_manager/chat_window_manager.xml
+++ b/addons/mail/static/src/components/chat_window_manager/chat_window_manager.xml
@@ -9,7 +9,7 @@
-
+
diff --git a/addons/mail/static/src/components/chatter/chatter.js b/addons/mail/static/src/components/chatter/chatter.js
index 71b14f4e9eb..9f0cee635b1 100644
--- a/addons/mail/static/src/components/chatter/chatter.js
+++ b/addons/mail/static/src/components/chatter/chatter.js
@@ -14,8 +14,8 @@ export class Chatter extends LegacyComponent {
setup() {
super.setup();
useUpdate({ func: () => this._update() });
- useComponentToModel({ fieldName: 'component', modelName: 'Chatter' });
- useRefToModel({ fieldName: 'scrollPanelRef', modelName: 'Chatter', refName: 'scrollPanel' });
+ useComponentToModel({ fieldName: 'component' });
+ useRefToModel({ fieldName: 'scrollPanelRef', refName: 'scrollPanel' });
}
//--------------------------------------------------------------------------
@@ -26,7 +26,7 @@ export class Chatter extends LegacyComponent {
* @returns {Chatter}
*/
get chatter() {
- return this.messaging && this.messaging.models['Chatter'].get(this.props.localId);
+ return this.props.record;
}
//--------------------------------------------------------------------------
@@ -58,7 +58,7 @@ export class Chatter extends LegacyComponent {
}
Object.assign(Chatter, {
- props: { localId: String },
+ props: { record: Object },
template: 'mail.Chatter',
});
diff --git a/addons/mail/static/src/components/chatter/chatter.xml b/addons/mail/static/src/components/chatter/chatter.xml
index f5e1a87ef41..304b54d0524 100644
--- a/addons/mail/static/src/components/chatter/chatter.xml
+++ b/addons/mail/static/src/components/chatter/chatter.xml
@@ -7,13 +7,13 @@
@@ -21,19 +21,19 @@
diff --git a/addons/mail/static/src/components/chatter_container/chatter_container.xml b/addons/mail/static/src/components/chatter_container/chatter_container.xml
index e8099e97f60..dd88f688a64 100644
--- a/addons/mail/static/src/components/chatter_container/chatter_container.xml
+++ b/addons/mail/static/src/components/chatter_container/chatter_container.xml
@@ -4,7 +4,7 @@
-
+
Please wait...
diff --git a/addons/mail/static/src/components/chatter_topbar/chatter_topbar.js b/addons/mail/static/src/components/chatter_topbar/chatter_topbar.js
index 99a3783ade6..8ba9f13633a 100644
--- a/addons/mail/static/src/components/chatter_topbar/chatter_topbar.js
+++ b/addons/mail/static/src/components/chatter_topbar/chatter_topbar.js
@@ -10,13 +10,13 @@ export class ChatterTopbar extends Component {
* @returns {Chatter}
*/
get chatter() {
- return this.messaging && this.messaging.models['Chatter'].get(this.props.localId);
+ return this.props.record;
}
}
Object.assign(ChatterTopbar, {
- props: { localId: String },
+ props: { record: Object },
template: 'mail.ChatterTopbar',
});
diff --git a/addons/mail/static/src/components/chatter_topbar/chatter_topbar.xml b/addons/mail/static/src/components/chatter_topbar/chatter_topbar.xml
index 4b73538fb4f..181f667371a 100644
--- a/addons/mail/static/src/components/chatter_topbar/chatter_topbar.xml
+++ b/addons/mail/static/src/components/chatter_topbar/chatter_topbar.xml
@@ -56,14 +56,14 @@
diff --git a/addons/mail/static/src/components/composer/composer.js b/addons/mail/static/src/components/composer/composer.js
index d04c91db924..f965f437603 100644
--- a/addons/mail/static/src/components/composer/composer.js
+++ b/addons/mail/static/src/components/composer/composer.js
@@ -13,8 +13,8 @@ export class Composer extends Component {
*/
setup() {
super.setup();
- useComponentToModel({ fieldName: 'component', modelName: 'ComposerView' });
- useRefToModel({ fieldName: 'buttonEmojisRef', modelName: 'ComposerView', refName: 'buttonEmojis' });
+ useComponentToModel({ fieldName: 'component' });
+ useRefToModel({ fieldName: 'buttonEmojisRef', refName: 'buttonEmojis' });
}
//--------------------------------------------------------------------------
@@ -25,13 +25,13 @@ export class Composer extends Component {
* @returns {ComposerView}
*/
get composerView() {
- return this.messaging && this.messaging.models['ComposerView'].get(this.props.localId);
+ return this.props.record;
}
}
Object.assign(Composer, {
- props: { localId: String },
+ props: { record: Object },
template: 'mail.Composer',
});
diff --git a/addons/mail/static/src/components/composer/composer.xml b/addons/mail/static/src/components/composer/composer.xml
index e8e6acf7791..f1356af2abf 100644
--- a/addons/mail/static/src/components/composer/composer.xml
+++ b/addons/mail/static/src/components/composer/composer.xml
@@ -20,7 +20,7 @@
@@ -48,7 +48,7 @@
-
+
@@ -75,7 +75,7 @@
'o_Composer_textInput-mobile': messaging.device.isSmall,
'o-has-current-partner-avatar': composerView.hasCurrentPartnerAvatar,
}"
- localId="composerView.localId"
+ record="composerView"
t-key="composerView.localId"
/>
@@ -116,13 +116,13 @@
@@ -42,7 +42,7 @@
-
+
diff --git a/addons/mail/static/src/components/thread_preview/thread_preview.js b/addons/mail/static/src/components/thread_preview/thread_preview.js
index da42da2c57f..53a72bed0e8 100644
--- a/addons/mail/static/src/components/thread_preview/thread_preview.js
+++ b/addons/mail/static/src/components/thread_preview/thread_preview.js
@@ -14,7 +14,7 @@ export class ThreadPreview extends Component {
*/
setup() {
super.setup();
- useRefToModel({ fieldName: 'markAsReadRef', modelName: 'ThreadPreviewView', refName: 'markAsRead' });
+ useRefToModel({ fieldName: 'markAsReadRef', refName: 'markAsRead' });
}
//--------------------------------------------------------------------------
@@ -49,13 +49,13 @@ export class ThreadPreview extends Component {
* @returns {ThreadPreviewView}
*/
get threadPreviewView() {
- return this.messaging && this.messaging.models['ThreadPreviewView'].get(this.props.localId);
+ return this.props.record;
}
}
Object.assign(ThreadPreview, {
- props: { localId: String },
+ props: { record: Object },
template: 'mail.ThreadPreview',
});
diff --git a/addons/mail/static/src/components/thread_preview/thread_preview.xml b/addons/mail/static/src/components/thread_preview/thread_preview.xml
index ed51938e0f8..70ce654278d 100644
--- a/addons/mail/static/src/components/thread_preview/thread_preview.xml
+++ b/addons/mail/static/src/components/thread_preview/thread_preview.xml
@@ -18,7 +18,7 @@
'o-isDeviceSmall': messaging.device.isSmall,
'o-muted': threadPreviewView.thread.localMessageUnreadCounter === 0,
}"
- partnerLocalId="threadPreviewView.thread.correspondent.localId"
+ partner="threadPreviewView.thread.correspondent"
/>
@@ -46,7 +46,7 @@
-
+
diff --git a/addons/mail/static/src/components/thread_textual_typing_status/thread_textual_typing_status.js b/addons/mail/static/src/components/thread_textual_typing_status/thread_textual_typing_status.js
index 64e3806d9f4..339e011bd6f 100644
--- a/addons/mail/static/src/components/thread_textual_typing_status/thread_textual_typing_status.js
+++ b/addons/mail/static/src/components/thread_textual_typing_status/thread_textual_typing_status.js
@@ -10,13 +10,13 @@ export class ThreadTextualTypingStatus extends Component {
* @returns {Thread}
*/
get thread() {
- return this.messaging && this.messaging.models['Thread'].get(this.props.threadLocalId);
+ return this.props.thread;
}
}
Object.assign(ThreadTextualTypingStatus, {
- props: { threadLocalId: String },
+ props: { thread: Object },
template: 'mail.ThreadTextualTypingStatus',
});
diff --git a/addons/mail/static/src/components/thread_view/thread_view.js b/addons/mail/static/src/components/thread_view/thread_view.js
index dfbd4abca81..09cfad1b51c 100644
--- a/addons/mail/static/src/components/thread_view/thread_view.js
+++ b/addons/mail/static/src/components/thread_view/thread_view.js
@@ -14,13 +14,13 @@ export class ThreadView extends Component {
* @returns {ThreadView}
*/
get threadView() {
- return this.messaging && this.messaging.models['ThreadView'].get(this.props.localId);
+ return this.props.record;
}
}
Object.assign(ThreadView, {
- props: { localId: String },
+ props: { record: Object },
template: 'mail.ThreadView',
});
diff --git a/addons/mail/static/src/components/thread_view/thread_view.xml b/addons/mail/static/src/components/thread_view/thread_view.xml
index e0b3bb9b8bc..a74b07b90d1 100644
--- a/addons/mail/static/src/components/thread_view/thread_view.xml
+++ b/addons/mail/static/src/components/thread_view/thread_view.xml
@@ -5,12 +5,12 @@
-
+
-
+
@@ -20,7 +20,7 @@
@@ -39,12 +39,12 @@
-
+
diff --git a/addons/mail/static/src/components/thread_view_topbar/thread_view_topbar.js b/addons/mail/static/src/components/thread_view_topbar/thread_view_topbar.js
index d6508a69da4..b3af1878ed9 100644
--- a/addons/mail/static/src/components/thread_view_topbar/thread_view_topbar.js
+++ b/addons/mail/static/src/components/thread_view_topbar/thread_view_topbar.js
@@ -13,11 +13,11 @@ export class ThreadViewTopbar extends Component {
*/
setup() {
super.setup();
- useRefToModel({ fieldName: 'guestNameInputRef', modelName: 'ThreadViewTopbar', refName: 'guestNameInput' });
- useRefToModel({ fieldName: 'inviteButtonRef', modelName: 'ThreadViewTopbar', refName: 'inviteButton' });
- useRefToModel({ fieldName: 'threadNameInputRef', modelName: 'ThreadViewTopbar', refName: 'threadNameInput' });
- useRefToModel({ fieldName: 'threadDescriptionInputRef', modelName: 'ThreadViewTopbar', refName: 'threadDescriptionInput' });
- useUpdateToModel({ methodName: 'onComponentUpdate', modelName: 'ThreadViewTopbar' });
+ useRefToModel({ fieldName: 'guestNameInputRef', refName: 'guestNameInput' });
+ useRefToModel({ fieldName: 'inviteButtonRef', refName: 'inviteButton' });
+ useRefToModel({ fieldName: 'threadNameInputRef', refName: 'threadNameInput' });
+ useRefToModel({ fieldName: 'threadDescriptionInputRef', refName: 'threadDescriptionInput' });
+ useUpdateToModel({ methodName: 'onComponentUpdate' });
}
//--------------------------------------------------------------------------
@@ -28,13 +28,13 @@ export class ThreadViewTopbar extends Component {
* @returns {ThreadViewTopbar}
*/
get threadViewTopbar() {
- return this.messaging && this.messaging.models['ThreadViewTopbar'].get(this.props.localId);
+ return this.props.record;
}
}
Object.assign(ThreadViewTopbar, {
- props: { localId: String },
+ props: { record: Object },
template: 'mail.ThreadViewTopbar',
});
diff --git a/addons/mail/static/src/components/thread_view_topbar/thread_view_topbar.xml b/addons/mail/static/src/components/thread_view_topbar/thread_view_topbar.xml
index 088b40e7f0f..4457a113c53 100644
--- a/addons/mail/static/src/components/thread_view_topbar/thread_view_topbar.xml
+++ b/addons/mail/static/src/components/thread_view_topbar/thread_view_topbar.xml
@@ -5,7 +5,7 @@
-
+
@@ -62,7 +62,7 @@
-
+
diff --git a/addons/mail/static/src/components/welcome_view/welcome_view.js b/addons/mail/static/src/components/welcome_view/welcome_view.js
index b3bc0a76ccd..8b55f63aaab 100644
--- a/addons/mail/static/src/components/welcome_view/welcome_view.js
+++ b/addons/mail/static/src/components/welcome_view/welcome_view.js
@@ -21,13 +21,13 @@ export class WelcomeView extends Component {
* @returns {WelcomeView}
*/
get welcomeView() {
- return this.messaging && this.messaging.models['WelcomeView'].get(this.props.localId);
+ return this.props.record;
}
}
Object.assign(WelcomeView, {
- props: { localId: String },
+ props: { record: Object },
template: 'mail.WelcomeView',
});
diff --git a/addons/mail/static/src/components/welcome_view/welcome_view.xml b/addons/mail/static/src/components/welcome_view/welcome_view.xml
index 9abbc4c70f2..6837183b9c4 100644
--- a/addons/mail/static/src/components/welcome_view/welcome_view.xml
+++ b/addons/mail/static/src/components/welcome_view/welcome_view.xml
@@ -10,7 +10,7 @@
-
+
diff --git a/addons/mail/static/src/model/model_manager.js b/addons/mail/static/src/model/model_manager.js
index 62afc4a2885..0145856a232 100644
--- a/addons/mail/static/src/model/model_manager.js
+++ b/addons/mail/static/src/model/model_manager.js
@@ -656,7 +656,7 @@ export class ModelManager {
// Field values of record.
__values: {},
});
- const record = !this.isDebug ? nonProxyRecord : new Proxy(nonProxyRecord, {
+ const record = owl.markRaw(!this.isDebug ? nonProxyRecord : new Proxy(nonProxyRecord, {
get: function getFromProxy(record, prop) {
if (
!model.__fieldMap[prop] &&
@@ -668,7 +668,7 @@ export class ModelManager {
}
return record[prop];
},
- });
+ }));
// Ensure X2many relations are Set initially (other fields can stay undefined).
for (const field of model.__fieldList) {
record.__values[field.fieldName] = undefined;
diff --git a/addons/mail/static/src/public/discuss_public_boot.js b/addons/mail/static/src/public/discuss_public_boot.js
index 2a10f2ee1aa..3200d29c8b3 100644
--- a/addons/mail/static/src/public/discuss_public_boot.js
+++ b/addons/mail/static/src/public/discuss_public_boot.js
@@ -85,7 +85,7 @@ async function createAndMountDiscussPublicView(templates) {
env: Component.env,
dev: Component.env.isDebug(),
props: {
- localId: discussPublicView.localId,
+ record: discussPublicView,
},
});
}
diff --git a/addons/mail/static/tests/helpers/test_utils.js b/addons/mail/static/tests/helpers/test_utils.js
index ba839ecb625..e23c78ac7ec 100644
--- a/addons/mail/static/tests/helpers/test_utils.js
+++ b/addons/mail/static/tests/helpers/test_utils.js
@@ -427,7 +427,7 @@ function getCreateComposerComponent({ env, modelManager, target }) {
}),
});
return await createRootMessagingComponent(env, "Composer", {
- props: { localId: composerView.localId, ...props },
+ props: { record: composerView, ...props },
target,
});
};
@@ -441,7 +441,7 @@ function getCreateComposerSuggestionComponent({ env, modelManager, target }) {
}),
});
await createRootMessagingComponent(env, "ComposerSuggestion", {
- props: { ...props, composerViewLocalId: composerView.localId },
+ props: { ...props, composerView: composerView },
target,
});
};
@@ -453,7 +453,7 @@ function getCreateFollowerListMenuComponent({ env, modelManager, target }) {
qunitTest: insertAndReplace(),
});
return await createRootMessagingComponent(env, "FollowerListMenu", {
- props: { localId: followerListMenuView.localId, threadLocalId: thread.localId, ...props },
+ props: { record: followerListMenuView, thread, ...props },
target,
});
};
@@ -466,7 +466,7 @@ function getCreateMessageComponent({ env, modelManager, target }) {
qunitTest: insertAndReplace(),
});
await createRootMessagingComponent(env, "Message", {
- props: { localId: messageView.localId },
+ props: { record: messageView },
target,
});
};
@@ -485,7 +485,7 @@ function getCreateNotificationListComponent({ env, modelManager, target }) {
qunitTestOwner: insertAndReplace(),
});
await createRootMessagingComponent(env, "NotificationList", {
- props: { localId: notificationListView.localId },
+ props: { record: notificationListView },
target,
});
};
@@ -508,7 +508,7 @@ function getCreateThreadViewComponent({ afterEvent, env, target }) {
actualTarget = target;
}
async function func() {
- return createRootMessagingComponent(env, "ThreadView", { props: { localId: threadView.localId, ...otherProps }, target: actualTarget });
+ return createRootMessagingComponent(env, "ThreadView", { props: { record: threadView, ...otherProps }, target: actualTarget });
}
if (waitUntilMessagesLoaded) {
await afterNextRender(() => afterEvent({
diff --git a/addons/mail/static/tests/qunit_suite_tests/components/follower_subtype_tests.js b/addons/mail/static/tests/qunit_suite_tests/components/follower_subtype_tests.js
index c3c9dabdbda..b21d356c5e1 100644
--- a/addons/mail/static/tests/qunit_suite_tests/components/follower_subtype_tests.js
+++ b/addons/mail/static/tests/qunit_suite_tests/components/follower_subtype_tests.js
@@ -16,8 +16,8 @@ QUnit.module('follower_subtype_tests.js', {
beforeEach() {
this.createFollowerSubtypeComponent = async ({ follower, followerSubtype, target }) => {
const props = {
- followerLocalId: follower.localId,
- followerSubtypeLocalId: followerSubtype.localId,
+ follower,
+ followerSubtype,
};
await createRootMessagingComponent(follower.env, "FollowerSubtype", {
props,
diff --git a/addons/mail/static/tests/qunit_suite_tests/components/follower_tests.js b/addons/mail/static/tests/qunit_suite_tests/components/follower_tests.js
index da7e3a6b8d4..6e824063617 100644
--- a/addons/mail/static/tests/qunit_suite_tests/components/follower_tests.js
+++ b/addons/mail/static/tests/qunit_suite_tests/components/follower_tests.js
@@ -16,7 +16,7 @@ QUnit.module('follower_tests.js', {
beforeEach() {
this.createFollowerComponent = async (follower, target) => {
await createRootMessagingComponent(follower.env, "Follower", {
- props: { followerLocalId: follower.localId },
+ props: { follower },
target,
});
};
diff --git a/addons/mail/static/tests/qunit_suite_tests/components/message_seen_indicator_tests.js b/addons/mail/static/tests/qunit_suite_tests/components/message_seen_indicator_tests.js
index c75ed30dc9d..0368301f128 100644
--- a/addons/mail/static/tests/qunit_suite_tests/components/message_seen_indicator_tests.js
+++ b/addons/mail/static/tests/qunit_suite_tests/components/message_seen_indicator_tests.js
@@ -12,7 +12,7 @@ QUnit.module('message_seen_indicator_tests.js', {
beforeEach() {
this.createMessageSeenIndicatorComponent = async ({ message, target, thread }, otherProps) => {
const props = Object.assign(
- { messageLocalId: message.localId, threadLocalId: thread.localId },
+ { message, thread },
otherProps
);
await createRootMessagingComponent(thread.env, "MessageSeenIndicator", {
diff --git a/addons/mail/static/tests/qunit_suite_tests/components/message_tests.js b/addons/mail/static/tests/qunit_suite_tests/components/message_tests.js
index 0507fbfc3cd..7cfd7cd92ff 100644
--- a/addons/mail/static/tests/qunit_suite_tests/components/message_tests.js
+++ b/addons/mail/static/tests/qunit_suite_tests/components/message_tests.js
@@ -548,7 +548,7 @@ QUnit.test('do not show messaging seen indicator if before last seen by all mess
},
]);
await createRootMessagingComponent(env, "Message", {
- props: { localId: threadViewer.threadView.messageViews[0].localId },
+ props: { record: threadViewer.threadView.messageViews[0] },
target,
});
diff --git a/addons/mail/static/tests/qunit_suite_tests/components/partner_im_status_icon_tests.js b/addons/mail/static/tests/qunit_suite_tests/components/partner_im_status_icon_tests.js
index 5eea555b805..9ad2a702129 100644
--- a/addons/mail/static/tests/qunit_suite_tests/components/partner_im_status_icon_tests.js
+++ b/addons/mail/static/tests/qunit_suite_tests/components/partner_im_status_icon_tests.js
@@ -12,7 +12,7 @@ QUnit.module('partner_im_status_icon_tests.js', {
beforeEach() {
this.createPartnerImStatusIcon = async (partner, target) => {
await createRootMessagingComponent(partner.env, "PartnerImStatusIcon", {
- props: { partnerLocalId: partner.localId },
+ props: { partner },
target,
});
};
diff --git a/addons/mail/static/tests/qunit_suite_tests/components/thread_icon_tests.js b/addons/mail/static/tests/qunit_suite_tests/components/thread_icon_tests.js
index 523d556d2f6..3bbb410936e 100644
--- a/addons/mail/static/tests/qunit_suite_tests/components/thread_icon_tests.js
+++ b/addons/mail/static/tests/qunit_suite_tests/components/thread_icon_tests.js
@@ -13,7 +13,7 @@ QUnit.module('thread_icon_tests.js', {
async beforeEach() {
this.createThreadIcon = async (thread, target) => {
await createRootMessagingComponent(thread.env, "ThreadIcon", {
- props: { threadLocalId: thread.localId },
+ props: { thread },
target,
});
};
diff --git a/addons/mail/static/tests/qunit_suite_tests/components/thread_textual_typing_status_tests.js b/addons/mail/static/tests/qunit_suite_tests/components/thread_textual_typing_status_tests.js
index 5b9d34ed146..cae963ec2ca 100644
--- a/addons/mail/static/tests/qunit_suite_tests/components/thread_textual_typing_status_tests.js
+++ b/addons/mail/static/tests/qunit_suite_tests/components/thread_textual_typing_status_tests.js
@@ -14,7 +14,7 @@ QUnit.module('thread_textual_typing_status_tests.js', {
beforeEach() {
this.createThreadTextualTypingStatusComponent = async (thread, target) => {
await createRootMessagingComponent(thread.env, "ThreadTextualTypingStatus", {
- props: { threadLocalId: thread.localId },
+ props: { thread },
target,
});
};
diff --git a/addons/snailmail/static/src/components/message/message.xml b/addons/snailmail/static/src/components/message/message.xml
index 265edb66d81..fbbf9f5b983 100644
--- a/addons/snailmail/static/src/components/message/message.xml
+++ b/addons/snailmail/static/src/components/message/message.xml
@@ -22,7 +22,7 @@
-->
-
+
$0
diff --git a/addons/snailmail/static/src/components/snailmail_error/snailmail_error.js b/addons/snailmail/static/src/components/snailmail_error/snailmail_error.js
index eadd73db71d..4ba3971bfca 100644
--- a/addons/snailmail/static/src/components/snailmail_error/snailmail_error.js
+++ b/addons/snailmail/static/src/components/snailmail_error/snailmail_error.js
@@ -11,20 +11,20 @@ export class SnailmailError extends Component {
* @override
*/
setup() {
- useComponentToModel({ fieldName: 'component', modelName: 'SnailmailErrorView' });
+ useComponentToModel({ fieldName: 'component' });
}
/**
* @returns {SnailmailErrorView}
*/
get snailmailErrorView() {
- return this.messaging && this.messaging.models['SnailmailErrorView'].get(this.props.localId);
+ return this.props.record;
}
}
Object.assign(SnailmailError, {
- props: { localId: String },
+ props: { record: Object },
template: 'snailmail.SnailmailError',
});
diff --git a/addons/snailmail/static/src/components/snailmail_notification_popover/snailmail_notification_popover.js b/addons/snailmail/static/src/components/snailmail_notification_popover/snailmail_notification_popover.js
index 6ab51696516..441a1597ec7 100644
--- a/addons/snailmail/static/src/components/snailmail_notification_popover/snailmail_notification_popover.js
+++ b/addons/snailmail/static/src/components/snailmail_notification_popover/snailmail_notification_popover.js
@@ -42,7 +42,7 @@ class SnailmailNotificationPopover extends Component {
* @returns {Message}
*/
get message() {
- return this.messaging && this.messaging.models['Message'].get(this.props.messageLocalId);
+ return this.props.message;
}
/**
@@ -56,9 +56,7 @@ class SnailmailNotificationPopover extends Component {
}
Object.assign(SnailmailNotificationPopover, {
- props: {
- messageLocalId: String,
- },
+ props: { message: Object },
template: 'snailmail.SnailmailNotificationPopover',
});
diff --git a/addons/website_livechat/static/src/components/thread_view/thread_view.xml b/addons/website_livechat/static/src/components/thread_view/thread_view.xml
index 5e084bea815..1b34415b48f 100644
--- a/addons/website_livechat/static/src/components/thread_view/thread_view.xml
+++ b/addons/website_livechat/static/src/components/thread_view/thread_view.xml
@@ -5,7 +5,7 @@
diff --git a/addons/website_livechat/static/src/components/visitor_banner/visitor_banner.js b/addons/website_livechat/static/src/components/visitor_banner/visitor_banner.js
index 1b6c5309985..6253cea7259 100644
--- a/addons/website_livechat/static/src/components/visitor_banner/visitor_banner.js
+++ b/addons/website_livechat/static/src/components/visitor_banner/visitor_banner.js
@@ -14,15 +14,13 @@ class VisitorBanner extends Component {
* @returns {Visitor}
*/
get visitor() {
- return this.messaging && this.messaging.models['Visitor'].get(this.props.visitorLocalId);
+ return this.props.visitor;
}
}
Object.assign(VisitorBanner, {
- props: {
- visitorLocalId: String,
- },
+ props: { visitor: Object },
template: 'website_livechat.VisitorBanner',
});