Project

General

Profile

Actions

Task #435

open

Barcode Print report for Pravik

Added by Amul Munusamy 4 days ago. Updated 1 day ago.

Status:
New
Priority:
Normal
Start date:
10/12/2026
Due date:
% Done:

0%

Estimated time:
Spent time:

Description

Coordinated and customization the Barcode label Print report for Pravik.


Files

clipboard-202610131609-f61wc.png (104 KB) clipboard-202610131609-f61wc.png Botchina Renukanth, 10/13/2026 10:39 AM
clipboard-202610131611-btmhs.png (109 KB) clipboard-202610131611-btmhs.png Botchina Renukanth, 10/13/2026 10:41 AM
clipboard-202610131612-6c0sv.png (112 KB) clipboard-202610131612-6c0sv.png Botchina Renukanth, 10/13/2026 10:42 AM
clipboard-202610131625-08hru.png (74.5 KB) clipboard-202610131625-08hru.png Botchina Renukanth, 10/13/2026 10:55 AM
clipboard-202610131626-a3z31.png (145 KB) clipboard-202610131626-a3z31.png Botchina Renukanth, 10/13/2026 10:56 AM
clipboard-202610131627-o0gmk.png (11.3 KB) clipboard-202610131627-o0gmk.png Botchina Renukanth, 10/13/2026 10:57 AM
clipboard-202610131642-wqmfl.png (77.2 KB) clipboard-202610131642-wqmfl.png Botchina Renukanth, 10/13/2026 11:12 AM
clipboard-202610131734-ft1rv.png (37.3 KB) clipboard-202610131734-ft1rv.png Botchina Renukanth, 10/13/2026 12:04 PM
Demo_video_for_creation_of_barcode_label_.mp4 (164 MB) Demo_video_for_creation_of_barcode_label_.mp4 Botchina Renukanth, 10/14/2026 01:17 PM

Updated by Botchina Renukanth 3 days ago ยท Edited

Create A Barcode Label:

  • Go to Settings and Active Developer Mode.
Menu Path: Settings --> Technical --> Reports.
  • Click on new and give Details as mentioned below.

  • Action Name : Barcode Label

  • Report Type : PDF

  • Model Name : purchase.order

  • Template Name : purchase_order.purchase_product_barcode_label

  • Open the Qweb Views and click on new give the details as mentioned below.

  • View Name : purchase_product_barcode_label

  • View Type : QWeb

  • Give the Xml/Html Code under the Architecture Tab.

<t t-name="purchase_order.purchase_product_barcode_label">
        <t t-call="web.basic_layout">
            <style>
                body { counter-reset: label-count; }
                .label-num::before {
                    counter-increment: label-count;
                    content: counter(label-count) ". ";
                }
            </style>

            <t t-foreach="docs" t-as="order">

                <t t-foreach="order.order_line" t-as="line">

                    <t t-if="not line.display_type and line.product_id and line.product_qty &gt; 0">

                        <!-- Repeat labels according to product quantity -->
                        <t t-foreach="range(0, int(line.product_qty), 2)" t-as="label_index">

                            <div class="page" style="height:30mm; margin:0; border:0.5px solid #000; box-sizing:border-box; page-break-after:always; page-break-inside:avoid; overflow:hidden;">

                                <table style="width:100mm; height:100%; table-layout:fixed; border-collapse:collapse; border:none; margin:0 auto; padding:0;">
                                    <tbody>
                                        <tr>

                                            <!-- Left and Right Labels -->
                                            <t t-foreach="range(0, 2)" t-as="column_index">

                                                <td style="width:50%; text-align:center; vertical-align:middle; padding:1mm; border:0.5px solid #000; box-sizing:border-box; overflow:hidden;">

                                                    <t t-if="label_index + column_index &lt; int(line.product_qty)">

                                                        <!-- Product Name -->
                                                        <div style="font-size: 12px; font-weight: bold; text-align: center;">
                                                            <span class="label-num"/><span t-field="line.product_id.name"/>
                                                        </div>

                                                        <!-- Product Price -->
                                                        <div style="font-size: 10px; text-align: center;">
                                                            Price:
                                                            <span t-field="line.price_unit" t-options="{'widget': 'monetary', 'display_currency': order.currency_id}"/>
                                                        </div>

                                                        <!-- Product Barcode -->
                                                        <div t-if="line.product_id.barcode" style="text-align: center;">
                                                            <span t-field="line.product_id.barcode" t-options="{'widget': 'barcode', 'symbology': 'Code128', 'width': 300, 'height': 60, 'img_style': 'width:40mm; height:8mm;'}"/>
                                                        </div>
                                                        
                                                        <!-- Barcode Number -->
                                                        <!--<div t-if="line.product_id.barcode" style="font-size: 9px; text-align: center;">-->
                                                        <!--    <span t-field="line.product_id.barcode"/>-->
                                                        <!--</div>-->

                                                        <!-- Product Reference -->
                                                        <div style="font-size: 9px; text-align: center;">
                                                            <span t-field="line.product_id.default_code"/>
                                                        </div>

                                                    </t>

                                                </td>

                                            </t>

                                        </tr>
                                    </tbody>
                                </table>

                            </div>

                        </t>

                    </t>

                </t>

            </t>

        </t>
    </t>

  • After that open the Bug Icon and open the Metadata view.

  • Then click the create on XML ID and give the details as shown in below.

  • Module : purchase_order

  • External Identifier : purchase_product_barcode_label

  • Save that record and go to that qweb view and there will be shown external id and module.

Menu Path: Settings --> Technical --> Paper Format.
  • click on new and give the details as shown in below.

  • After creating paper format.
Menu Path: Purchase --> Orders --> Purchase Orders.
  • Open any purchase order and click on setting and click on print.

  • Print the Barcode label.

Actions #3

Updated by Botchina Renukanth 2 days ago

Update:

  1. Added label_items to collect labels based on product quantity.
  2. Changed the loop to print two consecutive labels per row across different products.
  3. Added borders to both label boxes, including the empty box when the total label count is odd.
  4. Set page margin and padding to 0 to reduce unwanted spacing.

Updated code:

<t t-name="purchase_order.purchase_product_barcode_label">
    <t t-call="web.basic_layout">

        <t t-foreach="docs" t-as="order">

            <!-- Collect labels in purchase order sequence -->
            <t t-set="label_items" t-value="[]"/>

            <t t-foreach="order.order_line" t-as="line">
                <t t-if="not line.display_type and line.product_id and line.product_qty &gt; 0">
                    <t t-foreach="range(0, int(line.product_qty))" t-as="qty_index">
                        <t t-set="label_items" t-value="label_items + [(line, qty_index)]"/>
                    </t>
                </t>
            </t>

            <!-- Print two consecutive labels per row -->
           <div class="page" style="padding:0 !important; margin:0 !important;">

                <t t-foreach="range(0, len(label_items), 2)" t-as="label_index">

                    <div style="width:110mm; height:30mm; margin:0; padding:0; box-sizing:border-box; page-break-inside:avoid; overflow:hidden;">

                        <table style="width:100%; height:100%; table-layout:fixed; border-collapse:collapse; border:none; margin:0; padding:0;">
                            <tbody>
                                <tr>

                                    <t t-foreach="range(0, 2)" t-as="column_index">

                                        <td style="width:50%; text-align:center; vertical-align:middle; padding:1mm; border:0.5px solid #000; box-sizing:border-box; overflow:hidden;">
                                    
                                            <t t-if="label_index + column_index &lt; len(label_items)">
                                    
                                                <t t-set="line" t-value="label_items[label_index + column_index][0]"/>
                                    
                                                <!-- Product Name -->
                                                <div style="font-size:12px; font-weight:bold; text-align:center;">
                                                    <span t-field="line.product_id.name"/>
                                                </div>
                                    
                                                <!-- Product Price -->
                                                <div style="font-size:10px; text-align:center;">
                                                    Price:
                                                    <span t-field="line.price_unit"
                                                          t-options="{'widget': 'monetary', 'display_currency': order.currency_id}"/>
                                                </div>
                                    
                                                <!-- Product Barcode -->
                                                <div t-if="line.product_id.barcode" style="text-align:center;">
                                                    <span t-field="line.product_id.barcode"
                                                          t-options="{'widget': 'barcode', 'symbology': 'Code128', 'width': 300, 'height': 60, 'img_style': 'width:40mm; height:8mm;'}"/>
                                                </div>
                                    
                                                <!-- Product Reference -->
                                                <div style="font-size:9px; text-align:center;">
                                                    <span t-field="line.product_id.default_code"/>
                                                </div>
                                    
                                            </t>
                                    
                                        </td>
                                    
                                    </t>

                                </tr>
                            </tbody>
                        </table>

                    </div>

                </t>

            </div>

        </t>

    </t>
</t>
Actions

Also available in: Atom PDF