Odoo Help

0

0
1 Answer
0
Avatar

Avinash Nk India

--Avinash Nk--

10916
| 5 4 9
Calicut, India
--Avinash Nk--

Avinash N K

Odoo Developer

More than 3 years of experience in Odoo Technical

and Functional areas.

LinkedIn : https://in.linkedin.com/in/avinash-nk

Avinash Nk India
7/27/19, 6:28 AM

Hi,

Please try in this template. report_simple_barcode

<template id="report_simple_barcode">
<div style="width: 32%; 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: 4rem;">
<strong t-field="product.display_name"/>
</th>
</tr>
<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', 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&amp;value=%s&amp;width=%s&amp;height=%s' % ('EAN8', product.barcode, 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', 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>
</template>


Change the styles in the highlighted code as per your need.

Thanks

2 Comments
Altela Pramardhika Indonesia
7/29/19, 1:46 AM

Dear Avinash,

Thank you for your feedback. It worked like a charm.

For future reference, i head to settings > technical > views, and then search report_simple_barcode. Then, i edit some code just like Avinash suggest.

Thank you friend!

Altela Pramardhika Indonesia
7/29/19, 1:49 AM

Ohh and yes, one more thing,

Just for future reference, to make print preview show exactly like my barcode paper, i head to settings > technical > Reports, and then type in search Product Barcode. Then i edit paper format to be just like my barcode template size, so it will print as should be.

Ask a Question
Keep Informed
1 follower(s)
About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register
Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now