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

How can invisible Qweb Report based on field value??


<report
id="action_employee_contract"
model="hr.contract"
string="Employee Contract"
report_type="qweb-pdf"
name="hr_a.employee_contract"
file="hr_a.employee_contract"
/>


Community-v13


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

Thank you...

How to assign the report to group??

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

Hi,

Inherit the corresponding template/report and you can add an if condition, using if condition check the field value and show or hide the section.

Sample:

<tr>
<td class="text-center align-middle" style="height: 6rem;">
<t t-if="product.barcode">
<img alt="Barcode" t-if="len(product.barcode) == 13" t-att-src="'/report/barcode/?type=%s&amp;value=%s&amp;width=%s&amp;height=%s' % ('EAN13', quote_plus(product.barcode or ''), 600, 150)" style="width:100%;height:4rem;"/>
<img alt="Barcode" t-elif="len(product.barcode) == 8" t-att-src="'/report/barcode/?type=%s&amp;value=%s&amp;width=%s&amp;height=%s' % ('EAN8', quote_plus(product.barcode or ''), 600, 150)" style="width:100%;height:4rem;"/>
<img alt="Barcode" t-else="" t-att-src="'/report/barcode/?type=%s&amp;value=%s&amp;width=%s&amp;height=%s' % ('Code128', quote_plus(product.barcode or ''), 600, 150)" style="width:100%;height:4rem"/>
<span t-field="product.barcode"/>
</t>
<t t-else=""><span class="text-muted">No barcode available</span></t>
</td>
</tr>

Thanks

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
2
thg 6 24
6330
2
thg 3 24
1363
0
thg 1 24
1673
0
thg 1 24
1349
1
thg 12 22
9083