-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
closes #518 Signed-off-by: Matias Velazquez <[email protected]>
- Loading branch information
Showing
12 changed files
with
129 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
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_lines,access_stock_picking_zpl_lines,stock_ux.model_stock_picking_zpl_lines,base.group_user,1,1,1,1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# Part of Odoo. See LICENSE file for full copyright and licensing details. | ||
|
||
from odoo import _, fields, models,api, Command | ||
|
||
|
||
class ProductLabelLayout(models.TransientModel): | ||
_inherit = 'product.label.layout' | ||
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) | ||
active_ids = self._context.get('active_ids') or self._context.get('active_id') | ||
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,'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.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 | ||
|
||
class StockPickingZplLines(models.TransientModel): | ||
_name = 'stock.picking.zpl.lines' | ||
_description = "Print Stock Voucher lines" | ||
|
||
picking_zpl_id = fields.Many2one('product.label.layout') | ||
|
||
move_id = fields.Many2one('stock.move') | ||
|
||
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.") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.