Skip to content

Commit

Permalink
Merge PR OCA#817 into 16.0
Browse files Browse the repository at this point in the history
Signed-off-by jbaudoux
  • Loading branch information
OCA-git-bot committed Jan 24, 2024
2 parents 14e064c + f506215 commit 1a92414
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
9 changes: 5 additions & 4 deletions stock_available_to_promise_release/models/stock_picking.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,11 @@ def _compute_release_ready(self):
moves = picking.move_ids.filtered(lambda move: move._is_release_needed())
release_ready = False
release_ready_count = sum(1 for move in moves if move._is_release_ready())
if picking._get_shipping_policy() == "one":
release_ready = release_ready_count == len(moves)
else:
release_ready = bool(release_ready_count)
if moves:
if picking._get_shipping_policy() == "one":
release_ready = release_ready_count == len(moves)
else:
release_ready = bool(release_ready_count)
picking.release_ready_count = release_ready_count
picking.release_ready = release_ready

Expand Down
10 changes: 10 additions & 0 deletions stock_available_to_promise_release/tests/test_reservation.py
Original file line number Diff line number Diff line change
Expand Up @@ -1193,3 +1193,13 @@ def test_backorder_creation_after_release(self):
new_move = move.copy()
new_move._assign_picking()
self.assertNotEqual(picking, new_move.picking_id)

def test_cancel_release_ready(self):
self.wh.delivery_route_id.write({"available_to_promise_defer_pull": True})
self._update_qty_in_location(self.loc_bin1, self.product1, 20.0)
picking = self._create_picking_chain(
self.wh, [(self.product1, 5)], move_type="one"
)
self.assertTrue(picking.release_ready)
picking.action_cancel()
self.assertFalse(picking.release_ready)

0 comments on commit 1a92414

Please sign in to comment.