summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authorParth Choksi <pch@odoo.com>2019-04-24 12:27:00 +0000
committerParth Choksi <pch@odoo.com>2019-07-12 05:35:39 +0000
commitabcc8a58f05f5b0e5b41caec65b473da865f5fca (patch)
tree2ceb7b832e5402df8d77eeda12647b7ed547b08c /addons
parentcc62447a44c2cf4e2edaf8a1f6d94520e799ddd9 (diff)
[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>
Diffstat (limited to 'addons')
-rw-r--r--addons/stock/report/picking_templates.xml60
-rw-r--r--addons/stock/report/stock_report_views.xml13
2 files changed, 69 insertions, 4 deletions
diff --git a/addons/stock/report/picking_templates.xml b/addons/stock/report/picking_templates.xml
index 8d135dd0c40..5ddc0876e24 100644
--- a/addons/stock/report/picking_templates.xml
+++ b/addons/stock/report/picking_templates.xml
@@ -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">
diff --git a/addons/stock/report/stock_report_views.xml b/addons/stock/report/stock_report_views.xml
index ec047817265..add5acef33c 100644
--- a/addons/stock/report/stock_report_views.xml
+++ b/addons/stock/report/stock_report_views.xml
@@ -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)"