diff --git a/stock_ux/__manifest__.py b/stock_ux/__manifest__.py
index 04507afb4..4d98b01e8 100644
--- a/stock_ux/__manifest__.py
+++ b/stock_ux/__manifest__.py
@@ -39,6 +39,7 @@
'security/ir.model.access.csv',
'views/product_template_views.xml',
'views/product_product_views.xml',
+ 'wizards/stock_picking_wizard_views.xml',
'views/stock_picking_views.xml',
'views/stock_move_views.xml',
'views/stock_move_line_views.xml',
diff --git a/stock_ux/report/ir.action.reports.xml b/stock_ux/report/ir.action.reports.xml
index 7ab30dd77..4a37404fe 100644
--- a/stock_ux/report/ir.action.reports.xml
+++ b/stock_ux/report/ir.action.reports.xml
@@ -29,7 +29,7 @@
Etiqueta de despacho (PDF)
- stock.picking
+ stock.picking.zpl
qweb-pdf
stock_ux.custom_label_transfer_template_view_pdf
@@ -38,14 +38,26 @@
-
+
Etiquetas de Productos del picking (ZPL)
- stock.picking
+ stock.picking.zpl
qweb-text
stock_ux.custom_barcode_transfer_template_view_zpl
stock_ux.custom_barcode_transfer_template_view_zpl
report
+
+
+ Etiquetas zpl global
+ stock.picking.zpl
+
+ qweb-text
+ stock_ux.custom_label_transfer_template_view_zpl
+ stock_ux.custom_label_transfer_template_view_zpl
+ report
+
+
+
diff --git a/stock_ux/report/picking_templates.xml b/stock_ux/report/picking_templates.xml
index 44eefd4c4..09a8650a5 100644
--- a/stock_ux/report/picking_templates.xml
+++ b/stock_ux/report/picking_templates.xml
@@ -142,7 +142,7 @@ Fecha
-
+
@@ -310,8 +310,8 @@ Transportista:
-
-
+
+
^XA
@@ -320,32 +320,32 @@ Transportista:
^FO20,10,0
^FO260,10
-^A0N,20,25^FD^FS
+^A0N,20,25^FD^FS
^FO20,40
^A0N,40,30
^TBN,360,40
-^FD^FS
+^FD^FS
^FO20,90
^BY3
^BCN,60,Y,N,N,A
-^FD^FS
+^FD^FS
^FX Nueva etiqueta
^LH445,0
^FO20,10,0
^FO260,10
-^A0N,20,25^FD^FS
+^A0N,20,25^FD^FS
^FO20,40
^A0N,40,30
^TBN,360,40
-^FD^FS
+^FD^FS
^FO20,90
^BY3
^BCN,60,Y,N,N,A
-^FD^FS
+^FD^FS
^XZ
diff --git a/stock_ux/security/ir.model.access.csv b/stock_ux/security/ir.model.access.csv
index e95aaa534..9ddb120fd 100644
--- a/stock_ux/security/ir.model.access.csv
+++ b/stock_ux/security/ir.model.access.csv
@@ -1,2 +1,4 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_stock_operation_wizard,access_stock_operation_wizard,model_stock_operation_wizard,base.group_user,1,1,1,1
+stock_ux.access_stock_picking_zpl,access_stock_picking_zpl,stock_ux.model_stock_picking_zpl,base.group_user,1,1,1,1
+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
diff --git a/stock_ux/views/stock_picking_views.xml b/stock_ux/views/stock_picking_views.xml
index c0ce456e0..5bc5a2797 100644
--- a/stock_ux/views/stock_picking_views.xml
+++ b/stock_ux/views/stock_picking_views.xml
@@ -121,5 +121,16 @@
+
+
+ stock.picking
+
+ stock.picking.zpl
+
+
+ ]
+
+
+
diff --git a/stock_ux/wizards/__init__.py b/stock_ux/wizards/__init__.py
index dd59ed60e..e26b2c2a0 100644
--- a/stock_ux/wizards/__init__.py
+++ b/stock_ux/wizards/__init__.py
@@ -3,3 +3,5 @@
# directory
##############################################################################
from . import stock_operation_wizard
+from . import stock_picking_wizard
+
diff --git a/stock_ux/wizards/stock_picking_wizard.py b/stock_ux/wizards/stock_picking_wizard.py
index 1af6bf03b..d31eb25f4 100644
--- a/stock_ux/wizards/stock_picking_wizard.py
+++ b/stock_ux/wizards/stock_picking_wizard.py
@@ -1,4 +1,4 @@
-from odoo import fields, api, models, Command
+from odoo import fields, api, models, Command, exceptions
class StockPickingZpl(models.TransientModel):
@@ -7,7 +7,7 @@ class StockPickingZpl(models.TransientModel):
picking_id = fields.Many2one('stock.picking',string='picking')
line_ids = fields.One2many('stock.picking.zpl.lines','picking_zpl_id', string='Moves')
-
+
@api.model
def default_get(self, default_fields):
rec = super().default_get(default_fields)
@@ -15,13 +15,19 @@ def default_get(self, default_fields):
active_model = self._context.get('active_model')
if active_model == 'stock.picking':
move_ids = self.env[active_model].browse(active_ids).mapped('move_ids').filtered(lambda x: x.quantity > 0 )
- rec['line_ids'] = [Command.create({'move_id': x.id, 'move_quantity':x.quantity}) for x in move_ids]
+ rec['line_ids'] = [Command.create({'move_id': x.id, 'move_quantity':x.quantity,'move_uom_id': x.product_uom}) for x in move_ids]
return rec
-
+
def action_print(self):
self.ensure_one()
- report_id = self.env.ref("stock_ux.custom_label_transfer_template_view_zpl")
- import pdb;pdb.set_trace()
+ report_id = self.env.ref("stock_ux.action_custom_barcode_transfer_template_view_zpl")
+ report_action = report_id.report_action(self.ids)
+ report_action['close_on_report_download']=True
+ return report_action
+
+ def action_print_pdf(self):
+ self.ensure_one()
+ report_id = self.env.ref("stock_ux.action_custom_label_transfer_template_view_pdf")
report_action = report_id.report_action(self.ids)
report_action['close_on_report_download']=True
return report_action
@@ -36,4 +42,13 @@ class StockPickingZplLines(models.TransientModel):
move_quantity = fields.Float()
+ move_uom_id = fields.Many2one('uom.uom')
+
name = fields.Char(related='move_id.name')
+
+ @api.constrains('move_quantity')
+ def _check_move_quantity(self):
+ for line in self:
+ if line.move_quantity > line.move_id.quantity:
+ raise exceptions.ValidationError("La cantidad a imprimir no puede ser mayor que la cantidad original.")
+
diff --git a/stock_ux/wizards/stock_picking_wizard_views.xml b/stock_ux/wizards/stock_picking_wizard_views.xml
index f05963c82..162d495ae 100644
--- a/stock_ux/wizards/stock_picking_wizard_views.xml
+++ b/stock_ux/wizards/stock_picking_wizard_views.xml
@@ -13,17 +13,19 @@
+
-
+
Asistente para impresion de reporte ZPL
ir.actions.act_window
stock.picking.zpl