Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
5 Odpowiedzi
13820 Widoki

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

Awatar
Odrzuć
Najlepsza odpowiedź

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)

Awatar
Odrzuć
Autor Najlepsza odpowiedź

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>

Awatar
Odrzuć

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.

Najlepsza odpowiedź

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

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
1
lut 24
2261
7
lip 16
6144
2
sie 25
936
2
sie 25
2198
1
lip 25
748