The client wanted to change the size of barcode label to fit his label (2"x3"). At first, I tried adjusting the Margins using Studio but it didn't work.
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Kế toán
- Tồn kho
- PoS
- Project
- MRP
Câu hỏi này đã bị gắn cờ
I ended up creating an inherited view in debug mode by going to the main dashboard and typing "Views". Then searching for "barcode" and selecting the corresponding one to the report.
Then I added the following xpath:
<data inherit_id="product.report_simple_barcode" name="x_barcode size">
<xpath expr="//div" position="replace">
------!> Then, copy and paste the code from the main view, and change the highlighted values to adjust the barcode size:
<div style="width: 50%; display: inline-table; height: 10rem;">
<table class="table table-bordered mb-0" style="border: 2px solid black;">
<tr>
<th class="table-active text-left" style="height: 1rem;">
<strong t-field="product.display_name"/>
</th>
</tr>
<tr>
<td class="text-center align-middle" style="height: 11rem;">
<t t-if="product.barcode">
<img alt="Barcode" t-if="len(product.barcode) == 13" t-att-src="'/report/barcode/?type=%s&value=%s&width=%s&height=%s' % ('EAN13', product.barcode,600, 150)" style="width:100%;height:4rem;"/>
<img alt="Barcode" t-elif="len(product.barcode) == 8" t-att-src="'/report/barcode/?type=%s&value=%s&width=%s&height=%s' % ('EAN8', product.barcode, 600, 150)" style="width:100%;height:4rem;"/>
<img alt="Barcode" t-else="" t-att-src="'/report/barcode/?type=%s&value=%s&width=%s&height=%s' % ('Code128', product.barcode, 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>
</table>
</div>
</xpath>
</data>
Save. From here, you can edit the view in Studio.
Best practice is to create an inherited view so we don't edit the main view.
Below are screenshots of what each value in the XML corresponds to on the barcode label:
Bạn có hứng thú với cuộc thảo luận không? Đừng chỉ đọc, hãy tham gia nhé!
Tạo tài khoản ngay hôm nay để tận hưởng các tính năng độc đáo và tham gia cộng đồng tuyệt vời của chúng tôi!
Đăng kýBài viết liên quan | Trả lời | Lượt xem | Hoạt động | |
---|---|---|---|---|
|
4
thg 2 24
|
6235 | ||
|
3
thg 3 24
|
2665 | ||
|
0
thg 11 22
|
1892 | ||
|
2
thg 2 22
|
5464 | ||
|
0
thg 11 21
|
2484 |