Skip to content

Commit 931fa2f

Browse files
[FIX] shopfloor_reception: Ensure state assign of remainig move
1 parent 49d4fa1 commit 931fa2f

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
@@ -1305,7 +1305,6 @@ def _auto_post_line(self, selected_line):
13051305
new_move = move.create(split_move_vals)
13061306
new_move.move_line_ids = selected_line
13071307
new_move._action_confirm(merge=False)
1308-
new_move._recompute_state()
13091308
new_move._action_assign()
13101309
# Set back the quantity to do on one of the lines
13111310
line = fields.first(
@@ -1318,7 +1317,8 @@ def _auto_post_line(self, selected_line):
13181317
move.product_uom_qty, line[0].product_uom_id
13191318
)
13201319
line.product_uom_qty = move_quantity
1321-
move._recompute_state()
1320+
else:
1321+
move._action_assign()
13221322
new_move.extract_and_action_done()
13231323

13241324
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)