Odoo Help

0

Override JS mail

By
Grf
on 4/21/17, 4:42 AM 288 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;
    },
2
IT Libertas
On 4/21/17, 6:40 AM

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>

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

Grf
on 4/21/17, 12:10 PM

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)

Stats

Asked: 4/21/17, 4:42 AM
Seen: 288 times
Last updated: 4/21/17, 12:10 PM