Skip to Content
Menu
This question has been flagged
2 Replies
2273 Views

How can i override _processTrackingValues function in message.js in mail module

this is the code

odoo.define('mail.model.Message', function (require) {
"use strict";
var AbstractMessage = require('mail.model.AbstractMessage');
var Message =
AbstractMessage.extend(Mixins.EventDispatcherMixin, ServicesMixin, {
_processTrackingValues: function () {
if (this.hasTrackingValues()) {
_.each(this.getTrackingValues(), function (trackingValue) {
if (trackingValue.field_type === 'datetime') {
if (trackingValue.old_value) {
trackingValue.old_value =
moment
.utc(trackingValue.old_value)
.local()
.format('LLL');
}
if (trackingValue.new_value) {
trackingValue.new_value =
moment
.utc(trackingValue.new_value)
.local()
.format('LLL');
}
} else if (trackingValue.field_type === 'date') {
if (trackingValue.old_value) {
trackingValue.old_value =
moment(trackingValue.old_value)
.local()
.format('LL');
}
if (trackingValue.new_value) {
trackingValue.new_value =
moment(trackingValue.new_value)
.local()
.format('LL');
}
}
});
}
},
});

i'll be happy to hear an answer soon.

Avatar
Discard
Best Answer
Create a new js file and register it in assets bundle and use below block 

odoo.define('override.mail.message', function (require) {
var Message = require('mail.model.Message');
Message.include({
_processTrackingValues: function () {
// copy paste original method with your modification.
// if you want to call super method uncomment below line
// this._super.apply(this, arguments);
}
});
});
Avatar
Discard
Author Best Answer

thanks Ravi Gadhia, problem solved

Avatar
Discard