-
-
-
:
-
-
or
-
+
+
+
+
+ :
+
+
+
+ or
+
+
diff --git a/addons/mail/static/src/models/activity_list_view_item.js b/addons/mail/static/src/models/activity_list_view_item.js
index 7f9ece3b4b2..46ebf4a0732 100644
--- a/addons/mail/static/src/models/activity_list_view_item.js
+++ b/addons/mail/static/src/models/activity_list_view_item.js
@@ -1,7 +1,7 @@
/** @odoo-module **/
import { registerModel } from '@mail/model/model_core';
-import { attr, one } from '@mail/model/model_field';
+import { attr, many, one } from '@mail/model/model_field';
import { clear } from '@mail/model/model_field_command';
import { auto_str_to_date } from 'web.time';
@@ -103,6 +103,12 @@ registerModel({
return !this.fileUploader;
},
}),
+ mailTemplateViews: many('MailTemplateView', {
+ compute() {
+ return this.activity.mailTemplates.map(mailTemplate => ({ mailTemplate }));
+ },
+ inverse: 'activityListViewItemOwner',
+ }),
markDoneView: one('ActivityMarkDonePopoverContentView', {
inverse: 'activityListViewItemOwner',
}),
diff --git a/addons/mail/static/src/models/mail_template_view.js b/addons/mail/static/src/models/mail_template_view.js
index 847961792e1..a9fecab6d49 100644
--- a/addons/mail/static/src/models/mail_template_view.js
+++ b/addons/mail/static/src/models/mail_template_view.js
@@ -12,7 +12,10 @@ registerModel({
onClickPreview(ev) {
ev.stopPropagation();
ev.preventDefault();
- this.mailTemplate.preview(this.activityViewOwner.activity);
+ this.mailTemplate.preview(this.activity);
+ if (this.activityListViewItemOwner) {
+ this.activityListViewItemOwner.activityListViewOwner.popoverViewOwner.delete();
+ }
},
/**
* @param {MouseEvent} ev
@@ -20,12 +23,27 @@ registerModel({
onClickSend(ev) {
ev.stopPropagation();
ev.preventDefault();
- this.mailTemplate.send(this.activityViewOwner.activity);
+ this.mailTemplate.send(this.activity);
+ if (this.activityListViewItemOwner) {
+ this.activityListViewItemOwner.activityListViewOwner.popoverViewOwner.delete();
+ }
},
},
fields: {
+ activity: one('Activity', {
+ compute() {
+ if (this.activityViewOwner) {
+ return this.activityViewOwner.activity;
+ }
+ if (this.activityListViewItemOwner) {
+ return this.activityListViewItemOwner.activity;
+ }
+ }
+ }),
+ activityListViewItemOwner: one('ActivityListViewItem', {
+ inverse: 'mailTemplateViews',
+ }),
activityViewOwner: one('ActivityView', {
- identifying: true,
inverse: 'mailTemplateViews',
}),
mailTemplate: one('MailTemplate', {