Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
194 มุมมอง

I'm trying to create my own barcoded labels within Odoo 18.4 Online Studio. I've taken a look at some of the other solutions that used barcodes on their reports, but it's not really clear how the barcodes get added to the report.


I've been searching online, but everything I've found so far involves custom code, and unfortunately the Odoo online system doesn't allow for custom code.

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Hello Dan Cliff,

 

In Odoo Online (Studio environment), you don't have access to custom Python modules, but you can still add barcodes to your reports using QWeb XML directly inside Studio. The barcode images are generated dynamically by Odoo's built-in /report/barcode/ controller.

 

Here is how you can achieve it step by step:

  1. Open the Report in Studio
    • Go to the app and open the report you want to modify (eg, Sales Order ).
    • Click the Studio (wrench) icon to edit the layout.

  1. Insert a Field Area
    • Add a field, column, or block in the place where you want your barcode to appear.
    • This will create a space in the layout.

  1. Edit Report Sources (XML)
    • In Studio, click EDIT SOURCES .
    • This will open the underlying QWeb XML code.
  2. Insert the Barcode Snippet
    Add the following XML code where you want the barcode to display:

    """"""""""""""""""""""""""""""""
    <div>
    <div class="col-5">
    <span style="margin-left:-60px;">
    <img t-if="doc.client_order_ref"style="width:400px;height:70px;"t-att-src="'/report/barcode/?barcode_type=%s&value=%s&width=%s&height=%s' % ('EAN13', doc.client_order_ref, 265, 80)"/>
    </span>    
    <div style="margin-left:100px" t-field="doc.client_order_ref"/>
    </div>
    </div>    
    """""""""""""""""""""""""""""""""""""

 

  • Replace doc.client_order_ref with the field you want to encode as a barcode.
    Examples:
    • Sales Order Number → doc.name
    • Customer Reference → doc.client_order_ref
    • Invoice Number → doc.move_name
  1. Save and Preview
    • Click Save in Studio.
    • Preview or print the report.
    • You will now see both the reference text and a scannable barcode.



If you have any questions, feel free to reach out to us.

Hope this helps!


Thanks & Regards,

Email : odoo@aktivsoftware.com


อวตาร
ละทิ้ง