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

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) 

形象
丢弃
相关帖文 回复 查看 活动
1
2月 24
2276
7
7月 16
6153
2
8月 25
957
2
8月 25
2289
1
7月 25
823