Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
1 Rispondi
6369 Visualizzazioni

I was asked to change the thread view that shows at the bottom of pages.


I've created a file and loaded it in the __manifest__.py 


Here's the code:..


<?xml version="1.0" encoding="UTF-8"?>
<templates xml:space="preserve">

<t t-extend="mail.ChatThread.Message" t-name="ChatThread">
<t t-jquery=".o_mail_timestamp" t-operation="replace">
<small class="o_mail_timestamp" t-att-title="message.date">
<t t-esc="message.date"/>
</small>
</t>
</t>

</templates>


However, changes are not applied. Has anyone done this before?
Avatar
Abbandona
Risposta migliore

You could do it like:

<?xml version="1.0" encoding="UTF-8"?>
<templates xml:space="preserve">

<t t-extend="mail.ChatThread.Message">
<t t-jquery=".o_mail_timestamp" t-operation="replace">
<small class="o_mail_timestamp" t-att-title="message.date">
<t t-esc="message.date"/>
</small>
</t>
</t>

</templates>

Using different values for t-extend and t-name will create a new template with the value name of t-name that will inherit from the template with the value name of t-extend. Like models prototypal inheritance

Using just t-extend will inherit the original template in-place without creating a new one. The same applies for using only t-name overriding completely the original template and also using t-extend and t-name with the same value of the original template creating a new template with the name of the original one that inherits from that original one (no need to complicate it like that but works)



Avatar
Abbandona
Autore

Thanks Alex!

how can i do same code in V14

Post correlati Risposte Visualizzazioni Attività
2
lug 18
29084
1
gen 23
12662
0
ago 22
5660
1
mag 25
1046
2
mag 25
1094