Skip to content

Commit f18f2b0

Browse files
[IMP] repair_stock_consumption_step: use default location defined on picking type
1 parent dba88b3 commit f18f2b0

2 files changed

Lines changed: 10 additions & 4 deletions

File tree

repair_stock_consumption_step/models/repair_order.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Copyright 2025 ACSONE SA/NV
22
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
33

4-
from odoo import fields, models
4+
from odoo import Command, fields, models
55

66

77
class RepairOrder(models.Model):
@@ -44,8 +44,7 @@ def action_repair_done(self):
4444
{
4545
"picking_type_id": rec.warehouse_id.repair_consumption_picking_type_id.id,
4646
"origin": rec.name,
47-
"location_id": moves[0].location_id.id,
48-
"location_dest_id": moves[0].location_dest_id.id,
47+
"move_ids": [Command.set(moves.ids)],
4948
}
5049
)
5150

@@ -54,7 +53,6 @@ def action_repair_done(self):
5453
for move in moves:
5554
move_id_lots_ids_map[move.id] = move.move_line_ids.mapped("lot_id").ids
5655

57-
moves.picking_id = picking.id
5856
moves.move_line_ids.unlink()
5957
moves._action_confirm()
6058
moves._action_assign()

repair_stock_consumption_step/tests/test_repair_stock_consumption_step.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,14 @@ def test_repair_done_with_consumption_step(self):
8787
self.assertEqual(self.repair.operations.lot_id, pick.move_line_ids.lot_id)
8888
self.assertTrue(moves)
8989
self.assertEqual(pick.move_ids, moves)
90+
self.assertEqual(
91+
pick.location_id,
92+
self.warehouse.repair_consumption_picking_type_id.default_location_src_id,
93+
)
94+
self.assertEqual(
95+
pick.location_dest_id,
96+
self.warehouse.repair_consumption_picking_type_id.default_location_dest_id,
97+
)
9098
self.assertSetEqual(set(moves.mapped("state")), {"assigned"})
9199
self.assertIn(pick.state, "assigned")
92100
self.assertEqual(pick.move_line_ids, moves.move_line_ids)

0 commit comments

Comments
 (0)