mirror of
https://github.com/OCA/stock-logistics-warehouse.git
synced 2025-01-21 14:27:28 +02:00
[FIX] stock_quant_manual_assign: Correct handling of immediate transfers
This commit fixes the following issues: - The previous code does not handle the immediate transfer scenario when auto_fill_qty_done is selected in the operation type. This raises a missing-record error, trying to update qty_done on non-existing move line records. - move._do_unreserve() keeps existing stock.move.line records if there is some qty_done set, which is not a desirable outcome. All the linked move line records should be unlinked before selected quants are assigned.
This commit is contained in:
committed by
Aungkokolin1997
parent
d5ebefb538
commit
c7dc47b9c2
@@ -60,13 +60,16 @@ class AssignManualQuants(models.TransientModel):
|
||||
|
||||
def assign_quants(self):
|
||||
move = self.move_id
|
||||
move._do_unreserve()
|
||||
self.move_id.move_line_ids.unlink()
|
||||
for line in self.quants_lines:
|
||||
line._assign_quant_line()
|
||||
if move.picking_type_id.auto_fill_qty_done:
|
||||
# Auto-fill all lines as done
|
||||
for ml in move.move_line_ids:
|
||||
ml.qty_done = ml.reserved_uom_qty
|
||||
if move.from_immediate_transfer:
|
||||
move.quantity_done = self.lines_qty
|
||||
else:
|
||||
# Auto-fill all lines as done
|
||||
for ml in move.move_line_ids:
|
||||
ml.qty_done = ml.reserved_uom_qty
|
||||
move._recompute_state()
|
||||
move.mapped("picking_id")._compute_state()
|
||||
return {}
|
||||
|
||||
Reference in New Issue
Block a user