Skip to content

Commit

Permalink
[FIX] product: barcodes can be url encoded
Browse files Browse the repository at this point in the history
Steps to reproduce:
- install sales and barcodes
- go to sales > catalog > products > create
- give the product a random name and the following barcode: #1N4005-T+A
- save > print > product labels

Current behavior:
the barcode is not generated properly because it is not url encoded
everything after the # charachter is ignored

Current behavior:
barcodes are url encoded and generated properly

opw-2203716

closes odoo#48600

X-original-commit: 5aaacb8
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
  • Loading branch information
jhk-odoo committed Mar 30, 2020
1 parent 5615a4e commit 716898a
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions addons/product/report/product_product_templates.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
<tr>
<td class="text-center align-middle" style="height: 6rem">
<t t-if="product.barcode">
<img alt="Barcode" t-if="len(product.barcode) == 13" t-att-src="'/report/barcode/?type=%s&amp;value=%s&amp;width=%s&amp;height=%s' % ('EAN13', product.barcode, 600, 150)" style="width:100%;height::4rem;"/>
<img alt="Barcode" t-elif="len(product.barcode) == 8" t-att-src="'/report/barcode/?type=%s&amp;value=%s&amp;width=%s&amp;height=%s' % ('EAN8', product.barcode, 600, 150)" style="width:100%;height::4rem;"/>
<img alt="Barcode" t-else="" t-att-src="'/report/barcode/?type=%s&amp;value=%s&amp;width=%s&amp;height=%s' % ('Code128', product.barcode, 600, 150)" style="width:100%;height::4rem;"/>
<img alt="Barcode" t-if="len(product.barcode) == 13" t-att-src="'/report/barcode/?type=%s&amp;value=%s&amp;width=%s&amp;height=%s' % ('EAN13', quote_plus(product.barcode or ''), 600, 150)" style="width:100%;height::4rem;"/>
<img alt="Barcode" t-elif="len(product.barcode) == 8" t-att-src="'/report/barcode/?type=%s&amp;value=%s&amp;width=%s&amp;height=%s' % ('EAN8', quote_plus(product.barcode or ''), 600, 150)" style="width:100%;height::4rem;"/>
<img alt="Barcode" t-else="" t-att-src="'/report/barcode/?type=%s&amp;value=%s&amp;width=%s&amp;height=%s' % ('Code128', quote_plus(product.barcode or ''), 600, 150)" style="width:100%;height::4rem;"/>
<span t-field="product.barcode"/>
</t>
<t t-else=""><span class="text-muted">No barcode available</span></t>
Expand Down Expand Up @@ -53,9 +53,9 @@
<tr>
<td class="text-center align-middle" style="height: 6rem;">
<t t-if="product.barcode">
<img alt="Barcode" t-if="len(product.barcode) == 13" t-att-src="'/report/barcode/?type=%s&amp;value=%s&amp;width=%s&amp;height=%s' % ('EAN13', product.barcode, 600, 150)" style="width:100%;height:4rem;"/>
<img alt="Barcode" t-elif="len(product.barcode) == 8" t-att-src="'/report/barcode/?type=%s&amp;value=%s&amp;width=%s&amp;height=%s' % ('EAN8', product.barcode, 600, 150)" style="width:100%;height:4rem;"/>
<img alt="Barcode" t-else="" t-att-src="'/report/barcode/?type=%s&amp;value=%s&amp;width=%s&amp;height=%s' % ('Code128', product.barcode, 600, 150)" style="width:100%;height:4rem"/>
<img alt="Barcode" t-if="len(product.barcode) == 13" t-att-src="'/report/barcode/?type=%s&amp;value=%s&amp;width=%s&amp;height=%s' % ('EAN13', quote_plus(product.barcode or ''), 600, 150)" style="width:100%;height:4rem;"/>
<img alt="Barcode" t-elif="len(product.barcode) == 8" t-att-src="'/report/barcode/?type=%s&amp;value=%s&amp;width=%s&amp;height=%s' % ('EAN8', quote_plus(product.barcode or ''), 600, 150)" style="width:100%;height:4rem;"/>
<img alt="Barcode" t-else="" t-att-src="'/report/barcode/?type=%s&amp;value=%s&amp;width=%s&amp;height=%s' % ('Code128', quote_plus(product.barcode or ''), 600, 150)" style="width:100%;height:4rem"/>
<span t-field="product.barcode"/>
</t>
<t t-else=""><span class="text-muted">No barcode available</span></t>
Expand Down

0 comments on commit 716898a

Please sign in to comment.