Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions stock_batch_picking_ux/i18n/es.po
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,12 @@ msgstr "Origen"
msgid "Stock Voucher Book"
msgstr "Talonario de Remitos"

#. module: stock_batch_picking_ux
#. odoo-python
#: code:addons/stock_batch_picking_ux/models/stock_batch_picking.py:0
msgid "Please complete the vouchers book for the following pickings: %s"
msgstr "Por favor completá los talonarios de remito en los siguientes traslados: %s"

#. module: stock_batch_picking_ux
#. odoo-python
#: code:addons/stock_batch_picking_ux/models/stock_batch_picking.py:0
Expand Down
17 changes: 15 additions & 2 deletions stock_batch_picking_ux/models/stock_batch_picking.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class StockPickingBatch(models.Model):
# maneje en la vista para que si esta seteado pase dominio
# y si no esta seteado no
# required=True,
help="If you choose a partner then only pickings of this partner will" "be sellectable",
help="If you choose a partner then only pickings of this partner will be sellectable",
)
voucher_number = fields.Char()
voucher_required = fields.Boolean(
Expand Down Expand Up @@ -112,10 +112,23 @@ def action_done(self):
# al agregar la restriccion de que al menos una tenga que tener
# cantidad entonces nunca se manda el force_qty al picking
if all(operation.quantity == 0 for operation in rec.move_line_ids):
raise UserError(_("Debe definir Cantidad Realizada en al menos una " "operación."))
raise UserError(_("Debe definir Cantidad Realizada en al menos una operación."))

if rec.restrict_number_package and not rec.number_of_packages > 0:
raise UserError(_("The number of packages can not be 0"))

if rec.picking_type_id.book_required:
if rec.picking_type_id.book_id:
pickings_without_book = rec.picking_ids.filtered(lambda p: not p.book_id)
pickings_without_book.book_id = rec.picking_type_id.book_id
else:
pickings_without_book = rec.picking_ids.filtered(lambda p: not p.book_id)
if pickings_without_book:
raise UserError(
_("Please complete the vouchers book for the following pickings: %s")
% ", ".join(pickings_without_book.mapped("name"))
)

if rec.number_of_packages:
rec.picking_ids.write({"number_of_packages": rec.number_of_packages})

Expand Down
Loading