LaOsaCoop/Odoo16#5 add print cargory label: 60x35mm

This commit is contained in:
Luis 2025-05-14 12:34:26 +02:00
parent cfcbbe197a
commit 028c226d41
3 changed files with 85 additions and 0 deletions

View file

@ -17,6 +17,7 @@
], ],
"data": [ "data": [
"views/report_pricetag_normal.xml", "views/report_pricetag_normal.xml",
"views/report_pricetag_60x35.xml",
"views/product_print_category.xml", "views/product_print_category.xml",
"views/product_template_tag.xml", "views/product_template_tag.xml",
"views/product_template.xml", "views/product_template.xml",

View file

@ -15,4 +15,18 @@
/> />
</record> </record>
<record id="print_category_pricetag_normal_60x35" model="product.print.category">
<field name="name">Normal pricetag - 60x35mm</field>
<field name="qweb_view_id" ref="report_product_label_shelf_60x35" />
<field
name="field_ids"
eval="[(6, 0, [
ref('product.field_product_template__name'),
ref('product.field_product_template__seller_ids'),
ref('product.field_product_product__default_code'),
ref('product_origin.field_product_template__state_id'),
ref('product.field_product_template__list_price')])]"
/>
</record>
</odoo> </odoo>

View file

@ -0,0 +1,70 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<template id="report_product_label_shelf_60x35" >
<t t-foreach="category_data['lines']" t-as="line">
<t t-set="product" t-value="line.product_id.product_tmpl_id" />
<div
style="height: 3.85cm; width: 6.34cm; border: 2px solid black; text-align: center;
margin: 0; padding: 0; position: relative; display: inline-table; font-family: 'RobotoMono';">
<div class="text-center row"
style="display: block; margin: 0.5mm; font-size: 1em; text-align: center; line-height: 2px;">
<strong t-field="product.name" />
</div>
<div
style="font-size: 2em; vertical-align:bottom; position: absolute;
top: 19mm; left: 1mm;">
<strong><span
t-field="product.list_price"
t-options='{"widget": "float", "precision": 2}'
/> €</strong>
</div>
<t t-if="product.packaging_ids and product.packaging_ids[0].qty">
<div
style="vertical-align: bottom; position: absolute; bottom: 3mm; left: 3mm;
font-size: 0.8em; text-align: left;">
<t t-set="unit_price"
t-value="round(product.list_price / product.packaging_ids[0].qty, 1)" />
<strong>
<t t-out="unit_price" t-options='{"widget": "float", "precision": 2}' />
</strong>
<strong>/</strong>
<strong t-field="product.packaging_ids[0].name" />
</div>
</t>
<div
style="text-align: right; position: absolute; bottom: 1mm; right: 5mm; height: 16mm;
width: 27mm; ">
<t t-foreach="range(1, 7)" t-as="i">
<t t-set="done" t-value="False" />
<t t-foreach="product.tag_ids" t-as="label">
<t t-if="done == False and label.sequence == i">
<img style="width: 0.8cm; height: 0.8cm;"
t-attf-src="data:image/*;base64,{{label.image}}"
t-att-alt="label.name"
/>
<t t-set="done" t-value="True" />
</t>
</t>
<t t-if="done == False">
<!-- Empty label if no coincidence -->
<img style="width: 0.8cm; height: 0.8cm; opacity: 0;" />
</t>
</t>
</div>
<t t-if="product.barcode">
<div
style="vertical-align: bottom; position: absolute; bottom: 0mm; left: 3mm;
font-size: 0.7em; text-align: left;">
<span t-field="product.barcode" />
</div>
</t>
<div
style="position: absolute; bottom: 8mm; right: -7mm; font-size: 0.5em; text-align: left;
-webkit-transform: rotate(270deg);">
<span
t-out="context_timestamp(datetime.datetime.now()).strftime('%Y/%m/%d %H:%M')" />
</div>
</div>
</t>
</template>
</odoo>