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

I have an html field, and I want to set a default value this filed with in view

this is the python code:

payment_terms = fields.Html('Terms of Payment')

and this is the xml code

<field name=" payment_terms "/>

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

Hope it will be work

def _get_default_note(self):
result = """
    <div>
        <p class="terms">Payment terms are</p>
        <ul><li>15% in advance</li><ul/>
    </div>"""

return result

note = fields.Html(string='Description', required=True, default=_get_default_note)

อวตาร
ละทิ้ง
ผู้เขียน คำตอบที่ดีที่สุด

what I need is to set the below html code as default:

<div>

    <p class="terms">Payment terms are</p>

    <ul><li>15% in advance</li><ul/>

</div>

อวตาร
ละทิ้ง

Did you get any solution?

Yes, I did. 

‫في الاثنين، 16 يوليو 2018 في 3:34 م تمت كتابة ما يلي بواسطة ‪Ali Aljabal‬‏ <‪info@azitconsultants.com‬‏>:‬

Did you get any solution?

--
Ali Aljabal

Sent by Odoo S.A. using Odoo.

คำตอบที่ดีที่สุด

Use default= or compute= in your model (python code) 

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
1
ก.พ. 24
2302
odoo9: why default value does not work แก้ไขแล้ว
7
ก.ค. 16
6176
2
ส.ค. 25
998
2
ส.ค. 25
2357
1
ก.ค. 25
874