[IMP] mail: save/restore the feedback in the activity model

task-2397404

closes odoo/odoo#64094

X-original-commit: 74453020c89facd504c140023e302a72ae6b415e
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
This commit is contained in:
Didier (did)
2021-01-05 15:19:49 +00:00
parent 6d64212f08
commit 0a3ad62e40
3 changed files with 19 additions and 1 deletions
@@ -28,6 +28,9 @@ class ActivityMarkDonePopover extends Component {
mounted() {
this._feedbackTextareaRef.el.focus();
if (this.activity.feedbackBackup) {
this._feedbackTextareaRef.el.value = this.activity.feedbackBackup;
}
}
/**
@@ -59,6 +62,15 @@ class ActivityMarkDonePopover extends Component {
// Handlers
//--------------------------------------------------------------------------
/**
* @private
*/
_onBlur() {
this.activity.update({
feedbackBackup: this._feedbackTextareaRef.el.value,
});
}
/**
* @private
*/
@@ -4,7 +4,7 @@
<t t-name="mail.ActivityMarkDonePopover" owl="1">
<div class="o_ActivityMarkDonePopover" t-on-keydown="_onKeydown">
<t t-if="activity">
<textarea class="form-control o_ActivityMarkDonePopover_feedback" rows="3" placeholder="Write Feedback" t-ref="feedbackTextarea"/>
<textarea class="form-control o_ActivityMarkDonePopover_feedback" rows="3" placeholder="Write Feedback" t-on-blur="_onBlur" t-ref="feedbackTextarea"/>
<div class="o_ActivityMarkDonePopover_buttons">
<button type="button" class="o_ActivityMarkDonePopover_doneScheduleNextButton btn btn-sm btn-primary" t-on-click="_onClickDoneAndScheduleNext" t-esc="DONE_AND_SCHEDULE_NEXT"/>
<t t-if="!activity.force_next">
@@ -283,6 +283,12 @@ function factory(dependencies) {
creator: many2one('mail.user'),
dateCreate: attr(),
dateDeadline: attr(),
/**
* Backup of the feedback content of an activity to be marked as done in the popover.
* Feature-specific to restoring the feedback content when component is re-mounted.
* In all other cases, this field value should not be trusted.
*/
feedbackBackup: attr(),
force_next: attr({
default: false,
}),