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

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 "/>

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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)

Ảnh đại diện
Huỷ bỏ
Tác giả Câu trả lời hay nhất

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>

Ảnh đại diện
Huỷ bỏ

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.

Câu trả lời hay nhất

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

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 2 24
2097
7
thg 7 16
6026
0
thg 7 25
329
1
thg 6 25
999
0
thg 5 25
1112