콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
4 답글
15134 화면

Hi. The report gets the values from a model, and one of his fields is a boolean that returns True. The problem is that when I get this value in the report i see a string with the value "True" instead a checkbox checked.
The code I use for this field is :

¿Viven en casa otros familiares?: <span t-field="doc.otros_familiares_en_casa"/>

Can I use a checkbox instead "True" value?

아바타
취소
베스트 답변

Hello Deniel,


you can achieve this using below code:

<t t-if="doc.YOUR_BOLLEAN_FIELD">
    <input type="checkbox" id="checkbox104_anything_you_give" checked="checked"/>
</t>
below condition for print unchecked checkbox in PDF Report when condition is False
<t t-if="not doc.YOUR_BOLLEAN_FIELD">
    <input type="checkbox" id="checkbox104_anything_you_give"  />
</t>
Thanks
아바타
취소
베스트 답변

Previous solution are the way Odoo Studio does it.

A better solution would be:

<input type="checkbox" t-att-checked="doc.otros_familiares_en_casa"/>

아바타
취소

This is so much cleaner!! Great solution!

베스트 답변
<p class="form-check form-switch mb-0">
< t t-if="doc.field">
Yes:
<input type="checkbox"id="checkbox_field_true"checked="checked"/>
No:
<input type="checkbox"id="checkbox_field_false"/>
t>
<t t-if="not doc.field">
Yes:
<input type="checkbox"id="checkbox_field_true"/>
No:
<input type="checkbox"id="checkbox_field_false"checked="checked"/>
t>
p>
아바타
취소
베스트 답변

<t if = "doc.otros_familiares_en_casa">

    <input type="checkbox" checked="checked">

<t/>

<t if != "doc.otros_familiares_en_casa">

    <input type="checkbox">

<t/>


아바타
취소
관련 게시물 답글 화면 활동
1
4월 25
1167
2
3월 25
1284
4
11월 24
7034
1
3월 24
1954
3
9월 23
24720