Skip to content

Commit

Permalink
[ADD]Product_ux: Add zpl and pdf dispatch report
Browse files Browse the repository at this point in the history
  • Loading branch information
jcadhoc committed Jun 2, 2023
1 parent 32cb633 commit de8127f
Show file tree
Hide file tree
Showing 4 changed files with 340 additions and 0 deletions.
1 change: 1 addition & 0 deletions product_ux/__init__.py
Expand Up @@ -3,3 +3,4 @@
# directory
##############################################################################
from . import models
from . import report
4 changes: 4 additions & 0 deletions product_ux/__manifest__.py
Expand Up @@ -30,13 +30,17 @@
],
'depends': [
'product',
'stock_batch_picking_ux'
],
'data': [
'views/product_template_views.xml',
'views/product_product_views.xml',
'views/product_pricelist_item_view.xml',
'views/product_pricelist_view.xml',
'views/uom_uom_views.xml',
'report/ir.action.reports.xml',
'report/picking_templates.xml'

],
'demo': [
],
Expand Down
25 changes: 25 additions & 0 deletions product_ux/report/ir.action.reports.xml
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>

<record id="label_10x15" model="report.paperformat">
<field name="name">Etiqueta de despacho(10x15)</field>
<field name="default" eval="True"/>
<field name="format">custom</field>
<field name="page_height">150</field>
<field name="page_width">100</field>
<field name="orientation">Portrait</field>
<field name="margin_top">5</field>
<field name="margin_bottom">5</field>
<field name="margin_left">5</field>
<field name="margin_right">5</field>
<field name="header_line" eval="False"/>
<field name="header_spacing">20</field>
<field name="dpi">90</field>
</record>

<data>
<report id="action_custom_label_transfer_template_zpl" model="stock.picking" string="Etiqueta de despacho (ZPL)" name="product_ux.custom_label_transfer_template_view_zpl" file="product_ux.custom_label_transfer_template_view_zpl" report_type="qweb-text" />
</data>

<report id="action_custom_label_transfer_template_view_pdf" model="stock.picking" string="Etiqueta de despacho (PDF)" report_type="qweb-pdf" name="product_ux.custom_label_transfer_template_view_pdf" file="product_ux.custom_label_transfer_template_view_pdf" paperformat="product_ux.label_10x15"/>
</odoo>
310 changes: 310 additions & 0 deletions product_ux/report/picking_templates.xml
@@ -0,0 +1,310 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<data>
<template id="product_ux.custom_label_transfer_template_view_zpl">
<t t-foreach="docs" t-as="picking">
<t t-set="numero" t-value="0"/>
<t t-set="qty" t-value="picking.number_of_packages"/>
<t t-if="qty == 0">
<t t-set="qty" t-value="1"/>
</t>
<t t-foreach="range(qty)" t-as="item">
<t t-set="numero" t-value="numero + 1"/>
<t t-translation="off">
^XA
<!-- Inicio encabezado -->
<t t-if="picking.book_id">
<t t-if="picking.book_id.report_partner_id">
^CF0,60^CI28^FO50,50^FD
<t t-esc="picking.book_id.report_partner_id.name"/>
^FS ^CF0,30 ^FO50,115^FD
<t t-esc="picking.book_id.report_partner_id.street"/>
^FS ^FO50,155^FD
(<t t-esc="picking.partner_id.zip"/>
)<t t-esc="picking.book_id.report_partner_id.city"/>
^FS ^FO50,195^FD
<t class="oe_inline" t-esc="picking.book_id.report_partner_id.state_id.name"/>
,
<t class="oe_inline" t-esc="picking.book_id.report_partner_id.country_id.name"/>
^FS ^FO50,250^GB700,3,3^FS
</t>
<t t-else="">
^CF0,60^CI28^FO50,50^FD
<t t-esc="picking.book_id.company_id.name"/>
^FS ^CF0,30 ^FO50,115^FD
<t t-esc="picking.book_id.company_id.street"/>
^FS ^FO50,155^FD
(<t t-esc="picking.partner_id.zip"/>
)<t t-esc="picking.book_id.company_id.city"/>
^FS ^FO50,195^FD
<t class="oe_inline" t-esc="picking.book_id.company_id.state_id.name"/>
,
<t class="oe_inline" t-esc="picking.book_id.company_id.country_id.name"/>
^FS ^FO50,250^GB700,3,3^FS
</t>
</t>
<t t-else="">
^CF0,60 ^FO50,50^FD
<t t-esc="picking.company_id.name"/>
^FS ^CF0,30 ^CI28 ^FO50,115^FD
<t t-esc="picking.company_id.street"/>
^FS ^FO50,155^FD
(<t t-esc="picking.partner_id.zip"/>
)<t t-esc="picking.company_id.city"/>
^FS ^FO50,195^FD
<t class="oe_inline" t-esc="picking.company_id.state_id.name"/>
,
<t class="oe_inline" t-esc="picking.company_id.country_id.name"/>

^FS ^FO50,250^GB700,3,3^FS
<!-- Fin encabezado -->
</t>
<!-- Inicio destino -->
<t t-if="picking.partner_id.parent_id">
^FX Second section with recipient address and permit information. ^CFJ,23 ^FO50,280^FDDestinatario^FS ^CF0,45 ^TBN,700,100
^FO50,310^FD
<t t-esc="picking.partner_id.parent_id.name"/>
^FS
</t>
<t t-else="">
^FX Second section with recipient address and permit information. ^CFJ,23 ^FO50,280^FDDestinatario^FS ^CF0,45 ^TBN,700,100
^FO50,310^FD
<t t-esc="picking.partner_id.name"/>
^FS
</t>
^CF0,30 ^FO50,425^FD
<t t-esc="picking.partner_id.street"/>
^FS ^FO50,465^FD
<t class="oe_inline" t-esc="picking.partner_id.zip"/>
,
<t class="oe_inline" t-esc="picking.partner_id.city"/>
^FS ^FO50,505^FD
<t class="oe_inline" t-esc="picking.partner_id.state_id.name"/>
,
<t class="oe_inline" t-esc="picking.partner_id.country_id.name"/>
^FS ^FO50,545^FDTel: ^FS
<t t-if="picking.partner_id and (picking.partner_id.phone != False or picking.partner_id.mobile != False)">
<t t-if="picking.partner_id.phone">
^FO100,545^FD
<t t-esc="picking.partner_id.phone"/>
^FS
</t>
<t t-else="">
^FO100,545^FD
<t t-esc="picking.partner_id.mobile"/>
^FS
</t>
</t>
<t t-if="picking.partner_id.parent_id and (picking.partner_id.parent_id.phone != False or picking.partner_id.parent_id.mobile != False) and (picking.partner_id.phone == False and picking.partner_id.mobile == False)">
<t t-if="picking.partner_id.parent_id.phone">
^FO100,545^FD
<t t-esc="picking.partner_id.parent_id.phone"/>
^FS
</t>
<t t-else="">
^FO100,545^FD
<t t-esc="picking.partner_id.parent_id.mobile"/>
^FS
</t>
</t>
<t t-else="">
^FS
</t>
<!-- Fin destino -->
<t t-if="picking._fields.get('carrier_id') and picking.carrier_id">
Transportista:
^FX Transportista ^CFJ,30 ^FO50,615^FDTransportista: ^FS ^FO260,615^FD
<t t-esc="picking.carrier_id.name"/>
</t>
<t t-else="">
</t>
^FS^FS ^FO50,655^GB700,3,3^FS
^FX Referencias Odoo ^CFJ,25 ^FO50,680^FDOrden:^FS ^FO50,720^FDRemito:^FS ^CF0,28 ^FO160,680^FD
<t t-esc="picking.origin"/>
^FS ^FO160,720^FD
<t t-esc="picking.voucher_ids.name"/>
^FS ^BY3,2,160 ^FO100,765^BC^FD
<t t-esc="picking.name"/>
^FS ^FX Fecha y nro de bultos ^FO50,980^GB700,170,3^FS ^FO400,980^GB3,170,3^FS ^CFJ,30 ^FO180,1020^FDBultos^FS
^CF0,50 ^FO160,1070^FD<t t-esc="numero"/>
de <t t-if="picking.number_of_packages == 0">1</t>
<t t-else="">
<t t-esc="picking.number_of_packages"/>
</t>^FS ^CFJ,30 ^FO520,1020^FD
Fecha
^FS ^CF0,50 ^FO460,1070^FD
<t t-esc="picking.date_done" t-options="{'widget': 'date'}"/>
^FS ^XZ
</t>
</t>
</t>
</template>

<template id="product_ux.custom_label_transfer_template_view_pdf">
<t t-call="web.basic_layout">
<t t-foreach="docs" t-as="picking">
<t t-set="numero" t-value="0"/>
<t t-set="qty" t-value="picking.number_of_packages"/>
<t t-if="qty == 0">
<t t-set="qty" t-value="1"/>
</t>
<t t-foreach="range(qty)" t-as="item">
<t t-set="numero" t-value="numero + 1"/>
<t t-translation="off">
<!--inicio encabezado-->
<div class="container" style="page-break-before: always;">
<div name="section0" class="row">
<div class="col-12" style="page-break-before: always;">
<t t-if="picking._fields.get('book_id') and picking.book_id">
<t t-if="picking.book_id.report_partner_id">
<h4>
<span t-field="picking.book_id.report_partner_id.name"/>
</h4>
<br/>
<span t-field="picking.book_id.report_partner_id.street"/>
<br/>

( <span t-field="picking.partner_id.zip"/>
) <span t-field="picking.book_id.report_partner_id.city"/>
<br/>
<span class="oe_inline" t-field="picking.book_id.report_partner_id.state_id.name"/>
,
<span class="oe_inline" t-field="picking.book_id.report_partner_id.country_id.name"/>

</t>
<t t-else="">
<h4>
<span t-field="picking.book_id.company_id.name"/>
</h4>

<span t-field="picking.book_id.company_id.street"/>
<br/>
( <span t-field="picking.partner_id.zip"/>
) <span t-field="picking.book_id.company_id.city"/>
<br/>
<span class="oe_inline" t-field="picking.book_id.company_id.state_id.name"/>
,
<span class="oe_inline" t-field="picking.book_id.company_id.country_id.name"/>
</t>
</t>
<t t-else="">
<h4>
<span t-field="picking.company_id.name"/>
</h4>
<br/>
<span t-field="picking.company_id.street"/>
<br/>
( <span t-field="picking.partner_id.zip"/>
) <span t-field="picking.company_id.city"/>
<br/>
<span class="oe_inline" t-field="picking.company_id.state_id.name"/>
,
<span class="oe_inline" t-field="picking.company_id.country_id.name"/>
</t>

</div>
</div>

<!--Fin encabezado-->
<hr style="border-top: 1px solid black"/>
<!-- Inicio destino -->
<div style="font-weight: normal;">Destinatario:</div>
<h4 style="font-weight: normal;">
<t t-if="picking.partner_id.parent_id">
<t t-esc="picking.partner_id.parent_id.name"/>
</t>
<t t-else="">
<t t-esc="picking.partner_id.name"/>
</t>
</h4>

<t t-esc="picking.partner_id.street"/>
<br/>
[ <t class="oe_inline" t-esc="picking.partner_id.zip"/>
]
<t class="oe_inline" t-esc="picking.partner_id.city"/>
,
<t class="oe_inline" t-esc="picking.partner_id.state_id.name"/>
,
<t class="oe_inline" t-esc="picking.partner_id.country_id.name"/>
<div style="font-weight: normal;">Tel:
<t t-if="picking.partner_id and (picking.partner_id.phone != False or picking.partner_id.mobile != False)">
<t t-if="picking.partner_id.phone">
<t t-esc="picking.partner_id.phone"/>
</t>
<t t-else="">
<t t-esc="picking.partner_id.mobile"/>
</t>
</t>
<t t-if="picking.partner_id.parent_id and (picking.partner_id.parent_id.phone != False or picking.partner_id.parent_id.mobile != False) and (picking.partner_id.phone == False and picking.partner_id.mobile == False)">
<t t-if="picking.partner_id.parent_id.phone">
<t t-esc="picking.partner_id.parent_id.phone"/>
</t>
<t t-else="">
<t t-esc="picking.partner_id.parent_id.mobile"/>
</t>
</t>
<t t-else="">
</t>
</div>
<!-- Fin destino -->
<hr style="border-top: 1px solid black"/>
<!--Inicio pie-->

<t t-if="picking._fields.get('carrier_id') and picking.carrier_id">
Transportista:
<t t-esc="picking.carrier_id.name"/>
</t>
<t t-else="">
</t>
<div style="font-weight: normal;">Orden:
<t t-esc="picking.origin"/>
</div>
<div style="font-weight: normal;">Remito:
<t t-esc="picking.voucher_ids.name"/>
</div>
<br/>
<div name="footer_left_column" class="col-12 text-center">
<img t-if="picking.name" t-att-src="'/report/barcode/?type=%s&amp;value=%s&amp;humanreadable=1' % ('I2of5', picking.name)" alt="Barcode" style="height:40px;"/>
</div>

<div style="text-align: center;">
<t t-esc="picking.name"/>
</div>

<br/>

<table class="table table-bordered" style="width:100%; border: 1px solid black;">
<thead>
<tr>
<th style="width:50%">Número</th>
<th style="width:50%">Fecha</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:center;">
<t t-esc="numero"/>
de <t t-if="picking.number_of_packages == 0">1</t>
<t t-else="">
<t t-esc="picking.number_of_packages"/>
</t>
</td>
<td style="text-align:center;">
<t t-esc="picking.date_done" t-options="{'widget': 'date'}"/>
</td>
</tr>
</tbody>
</table>
</div>
<!--Fin pie-->


</t>
</t>
</t>
</t>
</template>

</data>
</odoo>

0 comments on commit de8127f

Please sign in to comment.