From 0ead074211217c6ab1d3f6aff70fef2f539a63db Mon Sep 17 00:00:00 2001 From: Arthur Maniet <arthurmaniet@me.com> Date: Thu, 24 Sep 2015 16:33:00 +0200 Subject: [PATCH] [IMP] stock: report to print locations barcodes Print 4 barcodes per page, in a disposition that is practical to print on stickers. --- .../stock/views/report_location_barcode.xml | 53 ++++++++++++------- 1 file changed, 35 insertions(+), 18 deletions(-) diff --git a/addons/stock/views/report_location_barcode.xml b/addons/stock/views/report_location_barcode.xml index ecb9c4b0a964..4ceec98075a6 100644 --- a/addons/stock/views/report_location_barcode.xml +++ b/addons/stock/views/report_location_barcode.xml @@ -2,26 +2,43 @@ <openerp> <data> <template id="report_location_barcode"> + <style type="text/css"> + .barcode { + position: absolute; + -webkit-transform: rotate(90deg); + width: 300px; + margin-left: -150px; + height: 50px; + margin-top: -25px; + } + .barcode:nth-child(1) { + top: 47mm; + left: 75%; + } + .barcode:nth-child(2) { + top: 161mm; + left: 75%; + } + .barcode:nth-child(3) { + top: 47mm; + left: 25%; + } + .barcode:nth-child(4) { + top: 161mm; + left: 25%; + } + </style> <t t-call="report.html_container"> - <t t-foreach="docs" t-as="o"> - <t> - <div class="page"> - <div class="oe_structure"/> - <div class="row"> - <div class="col-xs-6 mt6"> - <table class="table table-condensed" style="border-bottom: 3px solid black !important;"><thead><th> </th></thead></table> - <img t-if="not o.barcode" t-att-src="'/report/barcode/?type=%s&value=%s&width=%s&height=%s' % ('Code128', o.name, 600, 100)" style="width:300px;height:50px"/> - <img t-if="o.barcode" t-att-src="'/report/barcode/?type=%s&value=%s&width=%s&height=%s' % ('Code128', o.barcode, 600, 100)" style="width:300px;height:50px"/> - <p> - <span t-if="not o.barcode" t-field="o.name"/> - <span t-if="o.barcode" t-field="o.barcode"/> - </p> - </div> - </div> - </div> - </t> + <t t-foreach="[docs[x:x+4] for x in xrange(0, len(docs), 4)]" t-as="page_docs"> + <div class="page"> + <t t-foreach="page_docs" 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> + <img class="barcode" t-att-src="'/report/barcode/?type=%s&value=%s&width=%s&height=%s&humanreadable=1' % ('Code128', content, 600, 100)"/> + </t> + </div> </t> </t> </template> </data> -</openerp> \ No newline at end of file +</openerp> -- GitLab