Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
3692 มุมมอง

it's possible to add html widget in a tree view field?? like we add html widget in the form view fields. and it's work properly but when we add it in tree view no effect are visible, nothing happen

please help..

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

In Odoo 16.0, a not perfect solution in Python + XML could be as follow, if one consider a native Odoo fields description = fields.Html().

Notice any HTML done from native description field will be lost if some edit the description from description_text field. In the other way, meaning modification of description field renders HTML tag with some added character (e.g. <strong>hello</strong> is replaced by *hello*). 

Python :

from odoo.tools import html2plaintext, plaintext2html

@api.depends('description')

def _compute_description_text(self):

    for task in self:

        task.description_text = html2plaintext(task.description)

def _inverse_description_text(self):

    for task in self:

        task.description = plaintext2html(task.description_text)

In the XML view:

<field name="description" position="replace">

​<field name="description_text" />

</field>

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
Code View (</>) on HTML field in v15 แก้ไขแล้ว
2
มี.ค. 22
10721
0
ก.ค. 16
6073
0
พ.ค. 24
1471
0
ธ.ค. 23
1418
2
ส.ค. 23
14625