This question has been flagged
3 Replies
4019 Views

In mail/static/src/js/thread.js i need to change display_reply_icon: false, to True

so overriding JS is kinda more difficult for me because i'm realy new to, so looking for help.

as my thought process is i need to create model find this js script with Xpath and then override with my own js file.

init: function (parent, options) {
        this._super.apply(this, arguments);
        this.options = _.defaults(options || {}, {
            display_order: ORDER.ASC,
            display_needactions: true,
            display_stars: true,
            display_document_link: true,
            display_avatar: true,
            shorten_messages: true,
            squash_close_messages: true,
            display_reply_icon: false,
        });
        this.expanded_msg_ids = [];
        this.selected_id = null;
    },
Avatar
Discard
Best Answer

You should create a js file in your own module and extend initial function. Depending on an Odoo version, it should be done differently. E.g. for Odoo 10:



odoo.define('YOURMODULENAME.ChatThread',
function (require) {
"use strict";

var core = require('web.core');
var MailThread = require('mail.Thread');

var Thread = MailThread.extend({
className: 'o_mail_thread',
init: function (parent, options) { this._super.apply(this, arguments); this.options = _.defaults(options || {}, { display_order: ORDER.ASC, display_needactions: true, display_stars: true, display_document_link: true, display_avatar: true, squash_close_messages: true, display_email_icon: true, display_reply_icon: true, }); this.expanded_msg_ids = []; this.selected_id = null; },
)};



Do not forget to init your js in the xml template:

       
<template id="assets_backend" name="Genial
Selection Assets Backend" inherit_id="web.assets_backend">
       
    <xpath expr="." position="inside">
       
        <script type="text/javascript"
src="/YOURMODULENAME/static/src/js/ChatThread.js"></script>
       
    </xpath>
</template>

Avatar
Discard
Author

Once again i got great answer, really grateful for that.

Best Answer

Above code will give error for version 10, this is the correct code.

odoo.define('modulename.ChatThread',
function (require) {
"use strict";
var core = require('web.core');
var MailThread = require('mail.ChatThread');
var Thread = MailThread.include({
className: 'o_mail_thread',
init: function (parent, options) {
this._super.apply(this, arguments);
//this.options.display_stars = false;
//this.options.display_avatar = false;
this.options.display_reply_icon = true;
},
});
});


Avatar
Discard