Skip to content

Commit a2708a9

Browse files
committed
[IMP]stock_ux: refine ZPL label wizard flow
1 parent 6039891 commit a2708a9

12 files changed

Lines changed: 227 additions & 491 deletions

stock_ux/__manifest__.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,8 @@
4545
"views/report_deliveryslip.xml",
4646
"views/res_config_settings_views.xml",
4747
"wizards/stock_operation_wizard_views.xml",
48-
"views/stock_picking_voucher_views.xml",
48+
"wizards/stock_product_zpl_views.xml",
4949
"report/ir.action.reports.xml",
50-
"report/label_transfer_reports.xml",
51-
"report/label_transfer_template.xml",
5250
"report/picking_templates.xml",
5351
"views/res_company_views.xml",
5452
"views/stock_quant_views.xml",

stock_ux/models/stock_picking.py

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -23,22 +23,6 @@ class StockPicking(models.Model):
2323
copy=False,
2424
)
2525

26-
# Label/Voucher fields for tracking printed labels
27-
vouchers = fields.Char(
28-
string="Labels",
29-
compute="_compute_vouchers",
30-
help="Summary of printed labels for this transfer",
31-
)
32-
33-
def _compute_vouchers(self):
34-
"""Compute vouchers field - can be extended for tracking printed labels"""
35-
for rec in self:
36-
# Simple implementation - can be extended to track actual prints
37-
if rec.state == "done" and rec.date_done:
38-
rec.vouchers = f"Completed {rec.date_done.strftime('%d/%m/%Y')}"
39-
else:
40-
rec.vouchers = ""
41-
4226
def button_validate(self):
4327
"""
4428
We make checks before calling transfer
Lines changed: 11 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,25 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<odoo>
33

4-
<record id="paperformat_label_10x15" model="report.paperformat">
5-
<field name="name">Etiqueta de despacho (10x15)</field>
6-
<field name="default" eval="False"/>
7-
<field name="format">custom</field>
8-
<field name="page_height">150</field>
9-
<field name="page_width">100</field>
10-
<field name="orientation">Portrait</field>
11-
<field name="margin_top">5</field>
12-
<field name="margin_bottom">5</field>
13-
<field name="margin_left">5</field>
14-
<field name="margin_right">5</field>
15-
<field name="header_line" eval="False"/>
16-
<field name="header_spacing">20</field>
17-
<field name="dpi">90</field>
18-
</record>
19-
204
<record id="action_custom_barcode_transfer_template_view_zpl" model="ir.actions.report">
21-
<field name="name">Etiquetas de Productos del picking (ZPL)</field>
5+
<field name="name">Product Labels from Picking (ZPL)</field>
226
<field name="model">product.label.layout</field>
237
<field name="report_type">qweb-text</field>
248
<field name="report_name">stock_ux.custom_barcode_transfer_template_view_zpl</field>
259
<field name="report_file">stock_ux.custom_barcode_transfer_template_view_zpl</field>
2610
<field name="binding_type">report</field>
2711
</record>
2812

29-
<record id="action_report_picking_ux" model="ir.actions.report">
13+
<record id="action_product_barcode_zpl" model="ir.actions.report">
14+
<field name="name">Product Labels (ZPL)</field>
15+
<field name="model">product.label.layout</field>
16+
<field name="report_type">qweb-text</field>
17+
<field name="report_name">stock_ux.custom_product_barcode_zpl</field>
18+
<field name="report_file">stock_ux.custom_product_barcode_zpl</field>
19+
<field name="binding_type">report</field>
20+
</record>
21+
22+
<record id="action_report_picking_ux" model="ir.actions.report">
3023
<field name="name">Picking Operations</field>
3124
<field name="model">stock.picking</field>
3225
<field name="report_type">qweb-pdf</field>
@@ -37,16 +30,4 @@
3730
<field name="binding_type">report</field>
3831
</record>
3932

40-
<record id="action_custom_label_transfer_template_view_pdf" model="ir.actions.report">
41-
<field name="name">Etiqueta de Transferencia (PDF)</field>
42-
<field name="model">stock.picking</field>
43-
<field name="report_type">qweb-pdf</field>
44-
<field name="report_name">stock_ux.custom_label_transfer_template_view_pdf</field>
45-
<field name="report_file">stock_ux.custom_label_transfer_template_view_pdf</field>
46-
<field name="print_report_name">'Etiqueta - %s' % object.name</field>
47-
<field name="binding_model_id" ref="model_stock_picking"/>
48-
<field name="binding_type">report</field>
49-
<field name="paperformat_id" ref="stock_ux.paperformat_label_10x15"/>
50-
</record>
51-
5233
</odoo>

stock_ux/report/label_transfer_reports.xml

Lines changed: 0 additions & 44 deletions
This file was deleted.

stock_ux/report/label_transfer_template.xml

Lines changed: 0 additions & 67 deletions
This file was deleted.

stock_ux/report/label_transfer_template.xml.bak

Lines changed: 0 additions & 70 deletions
This file was deleted.

stock_ux/report/picking_templates.xml

Lines changed: 57 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<odoo>
33
<template id="stock_ux.custom_barcode_transfer_template_view_zpl">
4-
<t t-set="numero" t-value="0"/>
5-
<t t-as="l" t-foreach="docs">
6-
<t t-as="o" t-foreach="l.line_ids">
7-
<t t-as="i" t-foreach="range(0,int(o.move_quantity))">
8-
<t t-set="numero" t-value="numero + 1"/>
9-
<t t-if="numero % 2 != 0 ">
4+
<t t-set="label_count" t-value="0"/>
5+
<t t-as="l" t-foreach="docs">
6+
<t t-as="o" t-foreach="l.line_ids">
7+
<t t-as="i" t-foreach="range(0,int(o.move_quantity))">
8+
<t t-set="label_count" t-value="label_count + 1"/>
9+
<t t-if="label_count % 2 != 0">
1010
^XA
1111
^CI28
1212
^LH0,0
13-
^FO20,10,0
1413

1514
^FO250,10
1615
^A0N,20,25^FD<t t-esc="o.move_id.picking_id.date_done" t-options="{'widget': 'date'}"/>^FS
@@ -24,11 +23,10 @@
2423
^BY3
2524
^BCN,60,Y,N,N,A
2625
^FD<t t-esc="o.move_id.product_id.barcode"/>^FS
27-
</t>
28-
<t t-if="numero % 2 == 0 ">
29-
^FX Nueva etiqueta
26+
</t>
27+
<t t-if="label_count % 2 == 0">
28+
^FX Second label
3029
^LH445,0
31-
^FO20,10,0
3230
^FO250,10
3331
^A0N,20,25^FD<t t-esc="o.move_id.picking_id.date_done" t-options="{'widget': 'date'}"/>^FS
3432
^FO10,40
@@ -40,11 +38,56 @@
4038
^BCN,60,Y,N,N,A
4139
^FD<t t-esc="o.move_id.product_id.barcode"/>^FS
4240
^XZ
43-
</t>
44-
</t>
4541
</t>
4642
</t>
47-
<t t-if="numero % 2 != 0 "> ^PQ1,0,1,Y^XZ </t>
43+
</t>
44+
</t>
45+
<t t-if="label_count % 2 != 0"> ^PQ1,0,1,Y^XZ </t>
46+
</template>
47+
48+
<template id="stock_ux.custom_product_barcode_zpl">
49+
<t t-set="label_count" t-value="0"/>
50+
<t t-as="l" t-foreach="docs">
51+
<t t-as="o" t-foreach="l.product_line_ids">
52+
<t t-as="i" t-foreach="range(0,int(o.quantity))">
53+
<t t-set="label_count" t-value="label_count + 1"/>
54+
<t t-if="label_count % 2 != 0">
55+
^XA
56+
^CI28
57+
^LH0,0
58+
59+
^FO250,10
60+
^A0N,20,25^FD<t t-esc="context_timestamp(datetime.datetime.now()).strftime('%d/%m/%Y')"/>^FS
61+
62+
^FO10,40
63+
^A0N,40,30
64+
^TBN,360,40
65+
^FD<t t-esc="o.product_id.display_name"/>^FS
66+
67+
^FO10,90
68+
^BY3
69+
^BCN,60,Y,N,N,A
70+
^FD<t t-esc="o.product_id.barcode"/>^FS
71+
</t>
72+
<t t-if="label_count % 2 == 0">
73+
^FX Second label
74+
^LH445,0
75+
^FO250,10
76+
^A0N,20,25^FD<t t-esc="context_timestamp(datetime.datetime.now()).strftime('%d/%m/%Y')"/>^FS
77+
^FO10,40
78+
^A0N,40,30
79+
^TBN,360,40
80+
^FD<t t-esc="o.product_id.display_name"/>^FS
81+
^FO10,90
82+
^BY3
83+
^BCN,60,Y,N,N,A
84+
^FD<t t-esc="o.product_id.barcode"/>^FS
85+
^XZ
86+
</t>
87+
</t>
88+
</t>
89+
</t>
90+
<t t-if="label_count % 2 != 0"> ^PQ1,0,1,Y^XZ </t>
4891
</template>
4992

5093
<template id="stock_ux.custom_label_transfer_template_view_pdf">
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
22
access_stock_operation_wizard,access_stock_operation_wizard,model_stock_operation_wizard,base.group_user,1,1,1,1
33
stock_ux.access_stock_picking_zpl_lines,access_stock_picking_zpl_lines,stock_ux.model_stock_picking_zpl_lines,base.group_user,1,1,1,1
4+
stock_ux.access_stock_product_zpl_lines,access_stock_product_zpl_lines,stock_ux.model_stock_product_zpl_lines,base.group_user,1,1,1,1

0 commit comments

Comments
 (0)