Initial commit
This commit is contained in:
68
garazd_product_label/report/product_label_reports.xml
Normal file
68
garazd_product_label/report/product_label_reports.xml
Normal file
@@ -0,0 +1,68 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<odoo>
|
||||
|
||||
<record id="paperformat_label_a4_blank" model="report.paperformat">
|
||||
<field name="name">Label A4</field>
|
||||
<field name="format">A4</field>
|
||||
<field name="page_height">0</field>
|
||||
<field name="page_width">0</field>
|
||||
<field name="orientation">Portrait</field>
|
||||
<field name="margin_top">10</field>
|
||||
<field name="margin_bottom">10</field>
|
||||
<field name="margin_left">5</field>
|
||||
<field name="margin_right">5</field>
|
||||
<field name="header_line" eval="False"/>
|
||||
<field name="header_spacing">0</field>
|
||||
<field name="disable_shrinking" eval="True"/>
|
||||
<field name="dpi">96</field>
|
||||
<field name="default" eval="False"/>
|
||||
</record>
|
||||
|
||||
<record id="paperformat_label_50x38" model="report.paperformat">
|
||||
<field name="name">Label 50x38 mm</field>
|
||||
<field name="format">custom</field>
|
||||
<field name="page_height">38</field>
|
||||
<field name="page_width">50</field>
|
||||
<field name="orientation">Portrait</field>
|
||||
<field name="margin_top">1</field>
|
||||
<field name="margin_bottom">0</field>
|
||||
<field name="margin_left">0</field>
|
||||
<field name="margin_right">0</field>
|
||||
<field name="header_line" eval="False"/>
|
||||
<field name="header_spacing">0</field>
|
||||
<field name="disable_shrinking" eval="True"/>
|
||||
<field name="dpi">96</field>
|
||||
<field name="default" eval="False"/>
|
||||
</record>
|
||||
|
||||
<record id="action_report_product_label_A4_57x35" model="ir.actions.report">
|
||||
<field name="name">Product Labels 57x35mm (A4, 21 pcs)</field>
|
||||
<field name="model">print.product.label.line</field>
|
||||
<field name="report_type">qweb-pdf</field>
|
||||
<field name="paperformat_id" ref="paperformat_label_a4_blank"/>
|
||||
<field name="report_name">garazd_product_label.report_product_label_57x35_template</field>
|
||||
<field name="report_file">garazd_product_label.report_product_label_57x35_template</field>
|
||||
<field name="print_report_name">'Product Labels 57x35mm'</field>
|
||||
</record>
|
||||
|
||||
<record id="action_report_product_label_50x38" model="ir.actions.report">
|
||||
<field name="name">Product Labels 50x38mm</field>
|
||||
<field name="model">print.product.label.line</field>
|
||||
<field name="report_type">qweb-pdf</field>
|
||||
<field name="paperformat_id" ref="paperformat_label_50x38"/>
|
||||
<field name="report_name">garazd_product_label.report_product_label_50x38_template</field>
|
||||
<field name="report_file">garazd_product_label.report_product_label_50x38_template</field>
|
||||
<field name="print_report_name">'Product Labels 50x38mm'</field>
|
||||
</record>
|
||||
|
||||
<record id="action_report_product_label_from_template" model="ir.actions.report">
|
||||
<field name="name">Product Label from your own template</field>
|
||||
<field name="model">print.product.label.line</field>
|
||||
<field name="report_type">qweb-pdf</field>
|
||||
<field name="paperformat_id" ref="garazd_product_label.paperformat_label_a4_blank"/>
|
||||
<field name="report_name">garazd_product_label.report_product_label_from_template</field>
|
||||
<field name="report_file">garazd_product_label.report_product_label_from_template</field>
|
||||
<field name="print_report_name">'Product Labels Custom Design'</field>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
101
garazd_product_label/report/product_label_templates.xml
Normal file
101
garazd_product_label/report/product_label_templates.xml
Normal file
@@ -0,0 +1,101 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<odoo>
|
||||
|
||||
<template id="label_57x35">
|
||||
<table class="table" style="margin: 0; padding: 0;">
|
||||
<tr height="144px" style="border:0;margin:0;padding:0;">
|
||||
<td class="col-xs-4 text-center" style="border:0;margin:0;padding:0;">
|
||||
<div style="overflow:hidden; height:65px !important; padding: 5px 5px 0; line-height: 1.2;">
|
||||
<span t-field="label.product_id.name" style="line-height: 1.2;"/>
|
||||
<span t-if="label.product_id.product_template_attribute_value_ids"
|
||||
t-esc="u', '.join(map(lambda x: x.attribute_line_id.attribute_id.name + u': ' + x.name, label.product_id.product_template_attribute_value_ids))"
|
||||
class="badge"/>
|
||||
</div>
|
||||
<div style="width: 100%; padding: 0; margin: 0; font-size: 21px; font-weight: bold;">
|
||||
<span t-if="label.product_id.currency_id.position == 'before'" t-field="label.product_id.currency_id.symbol"/>
|
||||
<span t-field="label.product_id.lst_price"/>
|
||||
<span t-if="label.product_id.currency_id.position == 'after'" t-field="label.product_id.currency_id.symbol"/>
|
||||
</div>
|
||||
<div t-if="label.product_id.default_code" style="width: 100%; padding: 0; margin: 0; font-size: 12px;">
|
||||
<span t-field="label.product_id.default_code"/>
|
||||
</div>
|
||||
<t t-if="label.product_id.barcode">
|
||||
<div t-out="label.product_id.barcode" t-options="{'widget': 'barcode', 'symbology': 'auto', 'img_style': 'overflow: hidden; width: 100%; height: 1.4rem;', 'humanreadable': label.wizard_id.humanreadable}" class="px-1"/>
|
||||
</t>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</template>
|
||||
|
||||
<template id="report_product_label_57x35_template">
|
||||
<t t-call="web.html_container">
|
||||
<t t-call="web.basic_layout">
|
||||
<t t-set="count" t-value="0" />
|
||||
<div class="page">
|
||||
<div class="oe_structure"/>
|
||||
<t t-foreach="docs" t-as="label">
|
||||
<t t-set="qty" t-value="1" />
|
||||
<t t-if="label.qty">
|
||||
<t t-set="qty" t-value="label.qty" />
|
||||
</t>
|
||||
<t t-foreach="list(range(qty))" t-as="index_qty">
|
||||
<div t-if="count % 21 == 0" style="page-break-after:always;"/>
|
||||
<div t-if="count % 3 == 0" style="clear:both;"/>
|
||||
<div t-att-style="'width: 233px; float: left; height: 145px; margin: 0 4px 4px; border: {};'.format('%dpx solid #777;' % label.wizard_id.border_width if label.wizard_id.border_width else '0')">
|
||||
<t t-call="garazd_product_label.label_57x35"/>
|
||||
</div>
|
||||
<t t-set="count" t-value="count+1" />
|
||||
</t>
|
||||
</t>
|
||||
</div>
|
||||
</t>
|
||||
</t>
|
||||
</template>
|
||||
|
||||
<template id="report_product_label_50x38_template">
|
||||
<t t-call="web.html_container">
|
||||
<t t-call="web.basic_layout">
|
||||
<t t-foreach="docs" t-as="label">
|
||||
<t t-set="qty" t-value="1"/>
|
||||
<t t-if="label.qty" t-set="qty" t-value="label.qty" />
|
||||
<t t-foreach="list(range(qty))" t-as="index_qty">
|
||||
<div class="page" style="page-break-after: always;">
|
||||
<div style="height: 136px !important; width: 165px !important;">
|
||||
<table class="table" t-att-style="'height: 100%; border: {};'.format('%dpx solid #777;' % label.wizard_id.border_width if label.wizard_id.border_width else '0')">
|
||||
<tr style="border: 0;">
|
||||
<td class="text-center" style="padding: 0; margin: 0; border: 0;">
|
||||
<div style="overflow: hidden; height: 64px !important; font-size: 13px; line-height: 1.2; margin-bottom: 2px;">
|
||||
<span t-field="label.product_id.name" style="line-height: 1.2;"/>
|
||||
<span t-if="label.product_id.product_template_attribute_value_ids"
|
||||
t-esc="u', '.join(map(lambda x: x.attribute_line_id.attribute_id.name + u': ' + x.name, label.product_id.product_template_attribute_value_ids))"
|
||||
class="badge"/>
|
||||
</div>
|
||||
<div style="width: 100%; overflow: hidden; height: 26px !important;">
|
||||
<div style="float: right; width: 60%; font-size: 20px; font-weight: bold; line-height: 1.0; text-align: right; margin-bottom: 0px;">
|
||||
<span t-if="label.product_id.currency_id.position == 'before'" t-field="label.product_id.currency_id.symbol"/>
|
||||
<span t-field="label.product_id.lst_price"/>
|
||||
<span t-if="label.product_id.currency_id.position == 'after'" t-field="label.product_id.currency_id.symbol"/>
|
||||
</div>
|
||||
<div style="float: left; width: 40%; font-size: 10px; font-weight: 900; line-height: 1.0; text-align: left; margin-bottom: 0px; padding-top: 6px;">
|
||||
<span t-if="label.product_id.default_code"><span t-field="label.product_id.default_code"/> </span>
|
||||
</div>
|
||||
</div>
|
||||
<t t-if="label.product_id.barcode">
|
||||
<div t-out="label.product_id.barcode" style="margin-top: 5px;" t-options="{'widget': 'barcode', 'quiet': 0, 'symbology': 'auto', 'img_style': 'overflow: hidden; width: 100%; height: 2.0rem;', 'humanreadable': label.wizard_id.humanreadable}"/>
|
||||
</t>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</t>
|
||||
</t>
|
||||
</t>
|
||||
</t>
|
||||
</template>
|
||||
|
||||
<template id="report_product_label_from_template">
|
||||
<t t-call="web.basic_layout"/>
|
||||
</template>
|
||||
|
||||
</odoo>
|
||||
Reference in New Issue
Block a user