Skip to content

Commit 4db05de

Browse files
[FIX] shopfloor_reception: Ensure state assign of remainig move
1 parent c9cf770 commit 4db05de

2 files changed

Lines changed: 41 additions & 2 deletions

File tree

shopfloor_reception/services/reception.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1299,7 +1299,6 @@ def _auto_post_line(self, selected_line):
12991299
new_move = move.create(split_move_vals)
13001300
new_move.move_line_ids = selected_line
13011301
new_move._action_confirm(merge=False)
1302-
new_move._recompute_state()
13031302
new_move._action_assign()
13041303
# Set back the quantity to do on one of the lines
13051304
line = fields.first(
@@ -1312,7 +1311,8 @@ def _auto_post_line(self, selected_line):
13121311
move.product_uom_qty, line[0].product_uom_id
13131312
)
13141313
line.product_uom_qty = move_quantity
1315-
move._recompute_state()
1314+
else:
1315+
move._action_assign()
13161316
new_move.extract_and_action_done()
13171317

13181318
def set_destination(

shopfloor_reception/tests/test_set_destination.py

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,3 +199,42 @@ def test_auto_posting_concurent_work(self):
199199
self.assertEqual(picking.state, "assigned")
200200
# So the quantity left to do on the current move has decreased
201201
self.assertEqual(move.product_uom_qty, 9)
202+
203+
def test_auto_posting_partial_new_pack(self):
204+
self.menu.sudo().auto_post_line = True
205+
picking = self._create_picking()
206+
selected_move_line = picking.move_line_ids.filtered(
207+
lambda l: l.product_id == self.product_a
208+
)
209+
package_name = "FooBar"
210+
self.service.dispatch(
211+
"set_quantity",
212+
params={
213+
"barcode": package_name,
214+
"confirmation": "",
215+
"picking_id": picking.id,
216+
"quantity": 8,
217+
"selected_line_id": selected_move_line.id,
218+
},
219+
)
220+
self.service.dispatch(
221+
"set_quantity",
222+
params={
223+
"barcode": package_name,
224+
"confirmation": package_name,
225+
"picking_id": picking.id,
226+
"quantity": 8,
227+
"selected_line_id": selected_move_line.id,
228+
},
229+
)
230+
self.service.dispatch(
231+
"set_destination",
232+
params={
233+
"confirmation": True,
234+
"location_name": self.dispatch_location.name,
235+
"picking_id": picking.id,
236+
"selected_line_id": selected_move_line.id,
237+
},
238+
)
239+
move = picking.move_lines.filtered(lambda m: m.product_id == self.product_a)
240+
self.assertEqual(move.state, "assigned")

0 commit comments

Comments
 (0)