[IMP] knowledge: prevent article reload on chatter reload
Currently, when the chatter has to reload, it triggers a reload event for the parent view. In the case of Knowledge, we want to be able to exclusively reload the chatter because nothing changed in the article. In Knowledge, if the param `keepChanges` is used with reload, the full form view does not need to be fully reloaded. In this case, only the chatter will be updated. Task-2858428 X-original-commit: 91e268b580614da224f044061d01e69f09a5034d Part-of: odoo/odoo#93088
This commit is contained in:
@@ -48,6 +48,19 @@ const KnowledgeArticleFormController = FormController.extend({
|
||||
this._super.apply(this, arguments);
|
||||
this.onFieldSavedListeners = new Map();
|
||||
},
|
||||
/**
|
||||
* If a reload is called with param 'keepChanges', only the chatter needs
|
||||
* to be updated, no need for a full reload
|
||||
*
|
||||
* @override
|
||||
*/
|
||||
reload: function (params) {
|
||||
if (params && params.keepChanges) {
|
||||
return this.renderer.updateChatter();
|
||||
} else {
|
||||
return this._super.apply(this, arguments);
|
||||
}
|
||||
},
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
|
||||
@@ -45,6 +45,21 @@ const KnowledgeArticleFormRenderer = FormRenderer.extend(KnowledgeTreePanelMixin
|
||||
hasMessageIds: true,
|
||||
};
|
||||
},
|
||||
/**
|
||||
* Called when the chatter triggers a reload on the Form view with the
|
||||
* param 'keepChanges=true'. In this case, we only need to update the
|
||||
* chatter.
|
||||
*
|
||||
* @returns {Promise}
|
||||
*/
|
||||
updateChatter: function () {
|
||||
if (this._chatterContainerComponent && this.state.res_id) {
|
||||
const props = this._makeChatterContainerProps();
|
||||
return this._chatterContainerComponent.update(props);
|
||||
}
|
||||
this._closeChatter();
|
||||
return Promise.resolve();
|
||||
},
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user