@@ -310,8 +313,8 @@ Transportista:
-
-
+
+
^XA
@@ -320,32 +323,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 e95aaa53..9ddb120f 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 d55a2a1b..cef90691 100644
--- a/stock_ux/views/stock_picking_views.xml
+++ b/stock_ux/views/stock_picking_views.xml
@@ -117,4 +117,27 @@
+
+
+ stock.picking.form
+ stock.picking
+
+
+
+
+
+
+
+
+
+ stock.picking
+
+ stock.picking.zpl
+
+
+ ]
+
+
+
+
diff --git a/stock_ux/wizards/__init__.py b/stock_ux/wizards/__init__.py
index dd59ed60..e26b2c2a 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 27e63dba..d31eb25f 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,12 +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")
+ 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
@@ -35,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 f05963c8..525a2396 100644
--- a/stock_ux/wizards/stock_picking_wizard_views.xml
+++ b/stock_ux/wizards/stock_picking_wizard_views.xml
@@ -10,20 +10,22 @@
+
-
+
-
+
Asistente para impresion de reporte ZPL
ir.actions.act_window
stock.picking.zpl