跳至内容
菜单
此问题已终结
1 回复
6367 查看

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?
形象
丢弃
最佳答案

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)



形象
丢弃
编写者

Thanks Alex!

how can i do same code in V14

相关帖文 回复 查看 活动
2
7月 18
29084
1
1月 23
12660
0
8月 22
5654
1
5月 25
1038
2
5月 25
1091