[IMP] stock: added PDF version in the report of Barcodes

In Inventory, we have an option to print the report of Barcode in ZPL but we do
not have option to print the same in PDF.

After this commit, there will be a PDF version of the report of Barcodes
available just similar to the report in ZPL.

task-1970506

closes odoo/odoo#32935

Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
This commit is contained in:
Parth Choksi
2019-07-12 05:35:39 +00:00
parent cc62447a44
commit abcc8a58f0
2 changed files with 69 additions and 4 deletions
+59 -1
View File
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<data>
<template id="label_transfer_template_view">
<template id="label_transfer_template_view_zpl">
<t t-foreach="docs" t-as="picking">
<t t-foreach="picking.move_lines" t-as="move">
@@ -36,6 +36,64 @@
</t>
</template>
<template id="label_transfer_template_view_pdf">
<t t-call="web.basic_layout">
<div class="page">
<t t-foreach="docs" t-as="picking">
<t t-foreach="picking.move_lines" t-as="move">
<t t-foreach="move.move_line_ids" t-as="move_line">
<t t-if="move_line.product_uom_id.category_id.measure_type == 'unit'">
<t t-set="qty" t-value="int(move_line.qty_done)"/>
</t>
<t t-else="">
<t t-set="qty" t-value="1"/>
</t>
<t t-foreach="range(qty)" t-as="item">
<t t-translation="off">
<div style="display: inline-table; height: 10rem; width: 32%;">
<table class="table table-bordered" style="border: 2px solid black;" t-if="picking.move_lines">
<tr>
<th class="table-active text-left" style="height:4rem;">
<span t-esc="move.product_id.display_name"/>
</th>
</tr>
<t t-if="move_line.product_id.tracking != 'none'">
<tr>
<td class="text-center align-middle">
<t t-if="move_line.lot_name or move_line.lot_id">
<img t-att-src="'/report/barcode/?type=%s&amp;value=%s&amp;width=%s&amp;height=%s' % ('Code128', move_line.lot_name, 600, 150)" style="width:100%;height:4rem" alt="Barcode"/>
<span t-esc="move_line.lot_name or move_line.lot_id.name"/>
</t>
<t t-else="">
<span class="text-muted">No barcode available</span>
</t>
</td>
</tr>
</t>
<t t-if="move_line.product_id.tracking == 'none'">
<tr>
<td class="text-center align-middle" style="height: 6rem;">
<t t-if="move_line.product_id.barcode">
<img t-att-src="'/report/barcode/?type=%s&amp;value=%s&amp;width=%s&amp;height=%s' % ('Code128', move_line.product_id.barcode, 600, 150)" style="width:100%;height:4rem" alt="Barcode"/>
<span t-esc="move_line.product_id.barcode"/>
</t>
<t t-else="">
<span class="text-muted">No barcode available</span>
</t>
</td>
</tr>
</t>
</table>
</div>
</t>
</t>
</t>
</t>
</t>
</div>
</t>
</template>
<template id="label_picking_type_view">
<t t-foreach="docs" t-as="operation">
<t t-translation="off">
+10 -3
View File
@@ -113,13 +113,20 @@
file="stock.label_lot_template_view"
report_type="qweb-text"
/>
<report id="label_transfer_template"
<report id="action_label_transfer_template_zpl"
model="stock.picking"
string="Barcodes (ZPL)"
name="stock.label_transfer_template_view"
file="stock.label_transfer_template_view"
name="stock.label_transfer_template_view_zpl"
file="stock.label_transfer_template_view_zpl"
report_type="qweb-text"
/>
<report id="action_label_transfer_template_pdf"
model="stock.picking"
string="Barcodes (PDF)"
name="stock.label_transfer_template_view_pdf"
file="stock.label_transfer_template_view_pdf"
report_type="qweb-pdf"
/>
<report id="label_package_template"
model="stock.quant.package"
string="Package Barcode (ZPL)"