mirror of
https://github.com/OCA/stock-logistics-warehouse.git
synced 2025-01-21 14:27:28 +02:00
in planned transfers do not set the qty_done in move lines
This commit is contained in:
committed by
Joan Sisquella
parent
0b896aade8
commit
b7915c1472
@@ -102,11 +102,11 @@ class TestMoveLocation(TestsCommon):
|
||||
wizard.onchange_origin_location()
|
||||
wizard.with_context({'planned': True}).action_move_location()
|
||||
picking = wizard.picking_id
|
||||
self.assertEqual(picking.state, 'draft')
|
||||
self.assertEqual(picking.state, 'assigned')
|
||||
self.assertEqual(len(picking.move_line_ids), 4)
|
||||
self.assertEqual(
|
||||
sorted(picking.move_line_ids.mapped("qty_done")),
|
||||
[0.0, 0.0, 0.0, 0.0],
|
||||
sorted(picking.move_line_ids.mapped("product_uom_qty")),
|
||||
[1, 1, 1, 123],
|
||||
)
|
||||
|
||||
def test_quant_transfer(self):
|
||||
|
||||
@@ -150,6 +150,9 @@ class StockMoveLocationWizard(models.TransientModel):
|
||||
self._create_moves(picking)
|
||||
if not self.env.context.get("planned"):
|
||||
picking.button_validate()
|
||||
else:
|
||||
picking.action_confirm()
|
||||
picking.action_assign()
|
||||
self.picking_id = picking
|
||||
return self._get_picking_action(picking.id)
|
||||
|
||||
|
||||
@@ -96,12 +96,14 @@ class StockMoveLocationWizardLine(models.TransientModel):
|
||||
self.ensure_one()
|
||||
location_dest_id = self.destination_location_id.get_putaway_strategy(
|
||||
self.product_id).id or self.destination_location_id.id
|
||||
qty_todo, qty_done = self._get_available_quantity()
|
||||
return {
|
||||
"product_id": self.product_id.id,
|
||||
"lot_id": self.lot_id.id,
|
||||
"location_id": self.origin_location_id.id,
|
||||
"location_dest_id": location_dest_id,
|
||||
"qty_done": self._get_available_quantity(),
|
||||
"product_uom_qty": qty_todo,
|
||||
"qty_done": qty_done,
|
||||
"product_uom_id": self.product_uom_id.id,
|
||||
"picking_id": picking.id,
|
||||
"move_id": move.id,
|
||||
@@ -117,7 +119,7 @@ class StockMoveLocationWizardLine(models.TransientModel):
|
||||
return 0
|
||||
if self.env.context.get("planned"):
|
||||
# for planned transfer we don't care about the amounts at all
|
||||
return 0.0
|
||||
return self.move_quantity, 0
|
||||
search_args = [
|
||||
('location_id', '=', self.origin_location_id.id),
|
||||
('product_id', '=', self.product_id.id),
|
||||
@@ -137,4 +139,4 @@ class StockMoveLocationWizardLine(models.TransientModel):
|
||||
available_qty, self.move_quantity, rounding) == -1
|
||||
if available_qty_lt_move_qty:
|
||||
return available_qty
|
||||
return self.move_quantity
|
||||
return 0, self.move_quantity
|
||||
|
||||
Reference in New Issue
Block a user