[FIX] mail: Update the kanban record on activity creation/updation
Currently, scheduling the activity from the document chatter does not appear on the kanban record on activity button. and the 'onchange' action receives the ID of the activity that was marked as done and thus the 'Missing record' error So in this commit, on creation and done of activity reload the view to update the record on kanban card. The opportunity is taken to make a pass on all of the "reload" to add the `keepChanges` flag to prevent from losing pending changes on reload, especially useful in form view. closes odoo/odoo#63464 Taskid: 2362964 X-original-commit: 6d75304604687d873b296c630b87bc184e221018 Related: odoo/enterprise#15345 Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
This commit is contained in:
committed by
Sébastien Theys
parent
b6c688caa2
commit
1a58bcce08
@@ -153,9 +153,10 @@ class Activity extends Component {
|
||||
* @private
|
||||
* @param {MouseEvent} ev
|
||||
*/
|
||||
_onClickCancel(ev) {
|
||||
async _onClickCancel(ev) {
|
||||
ev.preventDefault();
|
||||
this.activity.deleteServerRecord();
|
||||
await this.activity.deleteServerRecord();
|
||||
this.trigger('reload', { keepChanges: true });
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+2
-2
@@ -69,11 +69,11 @@ class ActivityMarkDonePopover extends Component {
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
async _onClickDone() {
|
||||
async _onClickDone() {
|
||||
await this.activity.markAsDone({
|
||||
feedback: this._feedbackTextareaRef.el.value,
|
||||
});
|
||||
this.trigger('reload');
|
||||
this.trigger('reload', { keepChanges: true });
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -99,8 +99,7 @@ class ChatterTopbar extends Component {
|
||||
action,
|
||||
options: {
|
||||
on_close: () => {
|
||||
this.chatter.thread.refreshActivities();
|
||||
this.chatter.thread.refresh();
|
||||
this.trigger('reload', { keepChanges: true });
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
@@ -201,11 +201,11 @@ var BasicActivity = AbstractField.extend({
|
||||
if (rslt_action) {
|
||||
self.do_action(rslt_action, {
|
||||
on_close: function () {
|
||||
self.trigger_up('reload');
|
||||
self.trigger_up('reload', { keepChanges: true });
|
||||
},
|
||||
});
|
||||
} else {
|
||||
self.trigger_up('reload');
|
||||
self.trigger_up('reload', { keepChanges: true });
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -272,7 +272,7 @@ var BasicActivity = AbstractField.extend({
|
||||
activityID: activity.id,
|
||||
attachmentIds: _.pluck(files, 'id')
|
||||
}).then(function () {
|
||||
self.trigger_up('reload');
|
||||
self.trigger_up('reload', { keepChanges: true });
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -476,7 +476,7 @@ var BasicActivity = AbstractField.extend({
|
||||
},
|
||||
};
|
||||
return this.do_action(action, { on_close: function () {
|
||||
self.trigger_up('reload');
|
||||
self.trigger_up('reload', { keepChanges: true });
|
||||
} });
|
||||
},
|
||||
/**
|
||||
@@ -684,7 +684,7 @@ var KanbanActivity = BasicActivity.extend({
|
||||
* @private
|
||||
*/
|
||||
_reload: function () {
|
||||
this.trigger_up('reload', { db_id: this.record_id });
|
||||
this.trigger_up('reload', { db_id: this.record_id, keepChanges: true });
|
||||
},
|
||||
/**
|
||||
* @override
|
||||
|
||||
@@ -72,16 +72,14 @@ FormRenderer.include({
|
||||
this.on('o_chatter_rendered', this, ev => this._onChatterRendered(ev));
|
||||
if (this.chatterFields.hasRecordReloadOnMessagePosted) {
|
||||
this.on('o_message_posted', this, ev => {
|
||||
if(!this.state.isDirty()) {
|
||||
this.trigger_up('reload')
|
||||
}
|
||||
this.trigger_up('reload', { keepChanges: true });
|
||||
});
|
||||
}
|
||||
if (this.chatterFields.hasRecordReloadOnAttachmentsChanged) {
|
||||
this.on('o_attachments_changed', this, ev => this.trigger_up('reload', { keepChanges: true }));
|
||||
}
|
||||
if (this.chatterFields.hasRecordReloadOnFollowersUpdate) {
|
||||
owl.Component.env.bus.on('mail.thread:promptAddFollower-closed', this, ev => this.trigger_up('reload'));
|
||||
owl.Component.env.bus.on('mail.thread:promptAddFollower-closed', this, ev => this.trigger_up('reload', { keepChanges: true }));
|
||||
}
|
||||
},
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user