[IMP] stock: align location and picking type barcode reports

Creates a generic barcode template that prints the record name + its
associated barcode (if it exists). Generic template is a combination of
previously existing stock.picking.type and stock.location barcode
reports.

Updates stock.picking.type and stock.location barcode reports such that:
- they have a title (for clarity when combining them in the same pdf)
- they use the same (newly created) generic barcode template for an
  aligned look

Also adds some formatting changes (proper indentation for legibility).

Supports a review comment of overall barcode improvement task

Task: 1884520
Enterprise PR: odoo/enterprise#12086

Closes: odoo/odoo#55096
This commit is contained in:
Tiffany Chang (tic)
2020-08-20 15:06:08 +00:00
committed by svs-odoo
parent a4a788e648
commit 2ed3f2f98b
2 changed files with 20 additions and 34 deletions
+18 -11
View File
@@ -2,24 +2,31 @@
<odoo>
<data>
<template id="report_location_barcode">
<template id="report_generic_barcode">
<t t-call="web.html_container">
<div t-foreach="[[docs[x:x+2], docs[x+2:x+4]] for x in range(0, len(docs), 4)]" t-as="page_docs" class="page article page_stock_location_barcodes">
<div t-foreach="[[docs[x:x+2], docs[x+2:x+4]] for x in range(0, len(docs), 4)]" t-as="page_docs" class="page article">
<t t-if="title">
<h2 style="text-align: center; font-size: 3em"><t t-esc="title"/></h2>
</t>
<table height="1000">
<t t-foreach="page_docs" t-as="page_row">
<tr>
<t t-foreach="page_row" t-as="o">
<t t-if="o.barcode"><t t-set="content" t-value="o.barcode"/></t>
<t t-if="not o.barcode"><t t-set="content" t-value="o.name"/></t>
<td>
<img class="barcode" t-att-src="'/report/barcode/?type=%s&amp;value=%s&amp;width=%s&amp;height=%s&amp;humanreadable=1' % ('Code128', content, 600, 100)" alt="Barcode"/>
</td>
</t>
</tr>
<tr>
<t t-foreach="page_row" t-as="o">
<td>
<div style="text-align: center; font-size: 2em"><span t-field="o.name"/></div>
<img t-if="o.barcode" class="barcode" t-att-src="'/report/barcode/?type=%s&amp;value=%s&amp;width=%s&amp;height=%s&amp;humanreadable=1' % ('Code128', o.barcode, 600, 150)" alt="Barcode"/>
</td>
</t>
</tr>
</t>
</table>
</div>
</t>
</template>
<template id="report_location_barcode">
<t t-set="title">Locations</t>
<t t-call="stock.report_generic_barcode"/>
</template>
</data>
</odoo>
@@ -166,29 +166,8 @@
</t>
</template>
<template id="report_picking_type_label">
<t t-call="web.basic_layout">
<t t-foreach="docs" t-as="o">
<div class="page">
<div class="oe_structure"/>
<div class="row">
<div class="col-12">
<table class="table table-condensed" style="border-bottom: 0px solid white !important;width: 3in;">
<tr>
<th style="text-align: center;">
<span t-field="o.name"/>
</th>
</tr>
<tr>
<td name="td_pt_barcode" style="text-align: center; vertical-align: middle;" class="col-5">
<img t-if="o.barcode" t-att-src="'/report/barcode/?type=%s&amp;value=%s&amp;width=%s&amp;height=%s' % ('Code128', o.barcode, 600, 150)" style="width:100%;height:20%;"/>
</td>
</tr>
</table>
</div>
</div>
</div>
</t>
</t>
<t t-set="title">Operation Types</t>
<t t-call="stock.report_generic_barcode"/>
</template>
</data>
</odoo>