Odoo Help


How do I call a custom js function from in im_chat.xml in im_chat module?

Ahad Pashaeeian
on 8/23/15, 1:58 AM 728 views

 I try to call a JS function from my qweb im_chat.xml template via:

<t t-name="im_chat.Conversation_content">
   <t t-foreach="_.keys(list)" t-as="date">
    <div class="oe_im_chatview_date_separator">
    <!--<t t-esc="Date.parse(date).toString(Date.CultureInfo.formatPatterns.longDate)"/>-->
    <t t-esc="ToShamsi(parseInt('2015'), parseInt('8'), parseInt('22'), 'Long')"/>
    <t t-foreach="list[date]" t-as="bubble">
    <t t-if="bubble[0].type === 'message'">
    <t t-call="im_chat.Conversation_message_bubble">
    <t t-set="messages" t-value="bubble"/>
    <t t-if="bubble[0].type === 'meta'">
    <t t-call="im_chat.Conversation_technical_bubble">
    <t t-set="messages" t-value="bubble"/>

my js file include:

function ToShamsi(grgYear,grgMonth,grgDay,Format)




but odoo show me this error"

     Uncaught TypeError: undefined is not a function 

any suggestions?

Thank Before.

Uncaught Error: QWeb2 - template['im_chat.Conversation_content']: Runtime Error: TypeError: dict.Toshamsi is not a function

tashilgostar, Ahad Pashaeeian
on 8/23/15, 2:40 AM
hishig bat
On 11/23/16, 9:46 PM

I'm guessing my js function is not being defined, thus giving "'NoneType' object is not callable" error.

Tried writing it in my custom.js, which is working fine and inside the qweb. None works.

Can anybody help, please? I've been stuck on this for a whole month. :(

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

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.


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

2 follower(s)


Asked: 8/23/15, 1:58 AM
Seen: 728 times
Last updated: 12/12/16, 10:18 PM