0

I try to add a function to message in Inbox - send message to lead.

Ok, I've made like it is made by Odoo("dive into"): added a button near to "Mark as read"

/addons/mail/static/src/xml/thread.xml: added new with

class="fa fa-book o_thread_icon o_thread_message_message_to_lead"

then in

/addons/mail/static/src/js/thread.js
/addons/mail/static/src/js/client_action.js
/addons/mail/static/src/js/chat_manager.js

i've duplicated "mark_as_read" functions and replaced function name.

in addons/mail/models/mail_message.py added my function

So, it works! But I didn't find a way to pack it to a custom module: odoo reads /addons/mail/static/src/xml/thread.xml direct from the source and do not store it in DB. Ok, it is no problem, to add this line to one file, but how can I make it without js-modifying?

I've tried to put link or button there, but didn't find a way to make it like <record id="message_to_lead" model="ir.actions.server">..</record>

Can someone help me to find a way to make action-button for message, that calls a function in mail.message model?

enter image description here

Bhoomi Vaishnani
  • 718
  • 4
  • 19
SkiBY
  • 63
  • 1
  • 7

1 Answers1

0

Interesting thing - we can extend thread.xml template. But we must did it with something like:

<?xml version="1.0" encoding="UTF-8"?>
<template>
    <t t-extend="mail.ChatThread.Message">
        <t t-jquery='i[title="Mark as Read"]' t-operation="before">
            <i><a ... /></i>
        </t>
    </t>
</template>

And there can be action, js, or something else.

SkiBY
  • 63
  • 1
  • 7