Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
6382 Lượt xem

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?
Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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)



Ảnh đại diện
Huỷ bỏ
Tác giả

Thanks Alex!

how can i do same code in V14

Bài viết liên quan Trả lời Lượt xem Hoạt động
2
thg 7 18
29091
1
thg 1 23
12683
0
thg 8 22
5663
1
thg 5 25
1059
2
thg 5 25
1122