diff options
| author | Sébastien Theys <seb@odoo.com> | 2020-04-17 09:53:05 +0000 |
|---|---|---|
| committer | Sébastien Theys <seb@odoo.com> | 2020-04-17 12:17:57 +0000 |
| commit | dea52493b819939ae16391d8b19c2f404c7ec143 (patch) | |
| tree | da5729bab3ff9bc36825480f54c838b17fced580 /addons/mail/static/src/js/models/mail_failure.js | |
| parent | 69b51ce05e855b2b95e75919ac97996a1ff5e136 (diff) | |
[IMP] mail, sms, snailmail, test_mail_full: adapt mail.notification
The purpose is to have more common code for failure and notifications, with less
override in `sms` and `snailmail`.
task-2176017
closes odoo/odoo#44170
Related: odoo/enterprise#9140
Related: odoo/upgrade#918
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
Diffstat (limited to 'addons/mail/static/src/js/models/mail_failure.js')
| -rw-r--r-- | addons/mail/static/src/js/models/mail_failure.js | 41 |
1 files changed, 28 insertions, 13 deletions
diff --git a/addons/mail/static/src/js/models/mail_failure.js b/addons/mail/static/src/js/models/mail_failure.js index 232dd86152c..815c95a034f 100644 --- a/addons/mail/static/src/js/models/mail_failure.js +++ b/addons/mail/static/src/js/models/mail_failure.js @@ -30,14 +30,12 @@ var MailFailure = Class.extend(Mixins.EventDispatcherMixin, ServicesMixin, { this._documentID = data.res_id; this._documentModel = data.model; - this._failureType = data.failure_type || 'mail'; this._lastMessageDate = moment(); // by default: current datetime this._messageID = data.message_id; + this._messageType = data.message_type; this._modelName = data.model_name; this._moduleIcon = data.module_icon; this._notifications = data.notifications; - this._recordName = data.record_name; - this._uuid = data.uuid; if (data.last_message_date) { this._lastMessageDate = moment(time.str_to_datetime(data.last_message_date)); @@ -65,14 +63,6 @@ var MailFailure = Class.extend(Mixins.EventDispatcherMixin, ServicesMixin, { return this._documentID; }, /** - * Get the type of failure of this mail failure. - * - * @returns {string} - */ - getFailureType: function () { - return this._failureType; - }, - /** * Get the ID of the message that this mail failure is related to. * * @returns {integer} @@ -81,18 +71,26 @@ var MailFailure = Class.extend(Mixins.EventDispatcherMixin, ServicesMixin, { return this._messageID; }, /** + * Get the type of the message that this mail failure is related to. + * + * @returns {string} + */ + getMessageType() { + return this._messageType; + }, + /** * Get a valid object for the 'mail.preview' template * * @returns {Object} */ getPreview: function () { var preview = { - body: _t("An error occurred when sending an email"), + body: this._getPreviewBody(), date: this._lastMessageDate, documentID: this._documentID, documentModel: this._documentModel, id: 'mail_failure', - imageSRC: this._moduleIcon, + imageSRC: this._getPreviewImage(), title: this._modelName, }; return preview; @@ -105,6 +103,23 @@ var MailFailure = Class.extend(Mixins.EventDispatcherMixin, ServicesMixin, { isLinkedToDocument: function () { return !!(this._documentModel && this._documentID); }, + + //-------------------------------------------------------------------------- + // Private + //-------------------------------------------------------------------------- + + /** + * @returns {string} + */ + _getPreviewBody() { + return _t("An error occurred when sending an email."); + }, + /** + * @returns {string} + */ + _getPreviewImage() { + return '/mail/static/src/img/smiley/mailfailure.jpg'; + }, }); return MailFailure; |
