[IMP] mail: move hasParentReloadOnMessagePosted to models
Remove code from legacy form in preparation of Owl form. Part of task-2871070 Part-of: odoo/odoo#93273
This commit is contained in:
@@ -121,6 +121,10 @@ Object.assign(ChatterContainer, {
|
||||
type: Boolean,
|
||||
optional: true,
|
||||
},
|
||||
hasParentReloadOnMessagePosted: {
|
||||
type: Boolean,
|
||||
optional: true,
|
||||
},
|
||||
hasTopbarCloseButton: {
|
||||
type: Boolean,
|
||||
optional: true,
|
||||
|
||||
@@ -422,6 +422,9 @@ registerModel({
|
||||
hasParentReloadOnFollowersUpdate: attr({
|
||||
default: false,
|
||||
}),
|
||||
hasParentReloadOnMessagePosted: attr({
|
||||
default: false,
|
||||
}),
|
||||
/**
|
||||
* Determines whether `this.thread` should be displayed.
|
||||
*/
|
||||
|
||||
@@ -586,6 +586,7 @@ registerModel({
|
||||
postData.parent_id = this.threadView.replyingToMessageView.message.id;
|
||||
}
|
||||
const { threadView = {} } = this;
|
||||
const chatter = this.chatter;
|
||||
const { thread: chatterThread } = this.chatter || {};
|
||||
const { thread: threadViewThread } = threadView;
|
||||
const messageData = await this.messaging.rpc({ route: `/mail/message/post`, params });
|
||||
@@ -600,6 +601,9 @@ registerModel({
|
||||
threadView.update({ hasAutoScrollOnMessageReceived: true });
|
||||
threadView.addComponentHint('message-posted', { message });
|
||||
}
|
||||
if (chatter && chatter.exists() && chatter.hasParentReloadOnMessagePosted) {
|
||||
chatter.reloadParentView();
|
||||
}
|
||||
if (chatterThread) {
|
||||
if (this.exists()) {
|
||||
this.delete();
|
||||
|
||||
@@ -41,7 +41,6 @@ FormRenderer.include({
|
||||
this._super(...arguments);
|
||||
this._chatterContainerComponent = undefined;
|
||||
this.off('o_chatter_rendered', this);
|
||||
this.off('o_message_posted', this);
|
||||
},
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
@@ -71,11 +70,6 @@ FormRenderer.include({
|
||||
// Not in custom_events because other modules may remove this listener
|
||||
// while attempting to extend them.
|
||||
this.on('o_chatter_rendered', this, ev => this._onChatterRendered(ev));
|
||||
if (this.chatterFields.hasRecordReloadOnMessagePosted) {
|
||||
this.on('o_message_posted', this, ev => {
|
||||
this.trigger_up('reload', { keepChanges: true });
|
||||
});
|
||||
}
|
||||
},
|
||||
/**
|
||||
* @private
|
||||
@@ -88,6 +82,7 @@ FormRenderer.include({
|
||||
hasMessageList: this.chatterFields.hasMessageIds,
|
||||
hasParentReloadOnAttachmentsChanged: this.chatterFields.hasRecordReloadOnAttachmentsChanged,
|
||||
hasParentReloadOnFollowersUpdate: this.chatterFields.hasRecordReloadOnFollowersUpdate,
|
||||
hasParentReloadOnMessagePosted: this.chatterFields.hasRecordReloadOnMessagePosted,
|
||||
isAttachmentBoxVisibleInitially: this.chatterFields.isAttachmentBoxVisibleInitially,
|
||||
threadId: this.state.res_id,
|
||||
threadModel: this.state.model,
|
||||
|
||||
Reference in New Issue
Block a user