Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions shopfloor_reception/services/reception.py
Original file line number Diff line number Diff line change
Expand Up @@ -1305,7 +1305,6 @@ def _auto_post_line(self, selected_line):
new_move = move.create(split_move_vals)
new_move.move_line_ids = selected_line
new_move._action_confirm(merge=False)
new_move._recompute_state()
new_move._action_assign()
# Set back the quantity to do on one of the lines
line = fields.first(
Expand All @@ -1318,7 +1317,8 @@ def _auto_post_line(self, selected_line):
move.product_uom_qty, line[0].product_uom_id
)
line.product_uom_qty = move_quantity
move._recompute_state()
else:
move._action_assign()
new_move.extract_and_action_done()

def set_destination(
Expand Down
39 changes: 39 additions & 0 deletions shopfloor_reception/tests/test_set_destination.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,3 +199,42 @@ def test_auto_posting_concurent_work(self):
self.assertEqual(picking.state, "assigned")
# So the quantity left to do on the current move has decreased
self.assertEqual(move.product_uom_qty, 9)

def test_auto_posting_partial_new_pack(self):
self.menu.sudo().auto_post_line = True
picking = self._create_picking()
selected_move_line = picking.move_line_ids.filtered(
lambda l: l.product_id == self.product_a
)
package_name = "FooBar"
self.service.dispatch(
"set_quantity",
params={
"barcode": package_name,
"confirmation": "",
"picking_id": picking.id,
"quantity": 8,
"selected_line_id": selected_move_line.id,
},
)
self.service.dispatch(
"set_quantity",
params={
"barcode": package_name,
"confirmation": package_name,
"picking_id": picking.id,
"quantity": 8,
"selected_line_id": selected_move_line.id,
},
)
self.service.dispatch(
"set_destination",
params={
"confirmation": True,
"location_name": self.dispatch_location.name,
"picking_id": picking.id,
"selected_line_id": selected_move_line.id,
},
)
move = picking.move_lines.filtered(lambda m: m.product_id == self.product_a)
self.assertEqual(move.state, "assigned")