-
-
Notifications
You must be signed in to change notification settings - Fork 196
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[IMP] stock_release_channel_show_volume
Make one test per test
- Loading branch information
Showing
1 changed file
with
29 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
# Copyright 2023 Michael Tietz (MT Software) <[email protected]> | ||
# Copyright 2024 Jacques-Etienne Baudoux (BCIM) <[email protected]> | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html) | ||
|
||
from datetime import timedelta | ||
|
@@ -40,10 +41,7 @@ def assertVolumeFullProgress(self): | |
), | ||
) | ||
|
||
def test_computed_fields_counts(self): | ||
picking = self.picking | ||
|
||
self.channel.invalidate_cache() | ||
def test_computed_fields_counts_not_ready(self): | ||
self.assertVolume("all", [(self.product1, 5 * 3), (self.product2, 5 * 3)]) | ||
self.assertVolume("release_ready", []) | ||
self.assertVolume("released", []) | ||
|
@@ -54,10 +52,10 @@ def test_computed_fields_counts(self): | |
self.assertVolume("done", []) | ||
self.assertVolumeFullProgress() | ||
|
||
def test_computed_fields_counts_release_ready(self): | ||
self._update_qty_in_location(self.loc_bin1, self.product1, 20.0) | ||
self._update_qty_in_location(self.loc_bin1, self.product2, 20.0) | ||
|
||
self.channel.invalidate_cache() | ||
self.assertVolume("all", [(self.product1, 5 * 3), (self.product2, 5 * 3)]) | ||
self.assertVolume( | ||
"release_ready", [(self.product1, 5 * 3), (self.product2, 5 * 3)] | ||
|
@@ -70,10 +68,11 @@ def test_computed_fields_counts(self): | |
self.assertVolume("done", []) | ||
self.assertVolumeFullProgress() | ||
|
||
picking.release_available_to_promise() | ||
pick_picking = picking.move_lines.move_orig_ids.picking_id | ||
def test_computed_fields_counts_released(self): | ||
self._update_qty_in_location(self.loc_bin1, self.product1, 20.0) | ||
self._update_qty_in_location(self.loc_bin1, self.product2, 20.0) | ||
self.picking.release_available_to_promise() | ||
|
||
self.channel.invalidate_cache() | ||
self.assertVolume("all", [(self.product1, 5 * 3), (self.product2, 5 * 3)]) | ||
self.assertVolume( | ||
"release_ready", [(self.product1, 5 * 2), (self.product2, 5 * 2)] | ||
|
@@ -86,8 +85,15 @@ def test_computed_fields_counts(self): | |
self.assertVolume("done", []) | ||
self.assertVolumeFullProgress() | ||
|
||
picking.scheduled_date = fields.Datetime.now() - timedelta(hours=1) | ||
self.channel.invalidate_cache() | ||
def test_computed_fields_counts_late(self): | ||
self._update_qty_in_location(self.loc_bin1, self.product1, 20.0) | ||
self._update_qty_in_location(self.loc_bin1, self.product2, 20.0) | ||
self.picking.release_available_to_promise() | ||
# FIXME late should measure late internal operations, not late deliveries | ||
# pick_picking = self.picking.move_ids.move_orig_ids.picking_id | ||
# pick_picking.scheduled_date = fields.Datetime.now() - timedelta(hours=1) | ||
self.picking.scheduled_date = fields.Datetime.now() - timedelta(hours=1) | ||
|
||
self.assertVolume("all", [(self.product1, 5 * 3), (self.product2, 5 * 3)]) | ||
self.assertVolume( | ||
"release_ready", [(self.product1, 5 * 2), (self.product2, 5 * 2)] | ||
|
@@ -100,24 +106,33 @@ def test_computed_fields_counts(self): | |
self.assertVolume("done", []) | ||
self.assertVolumeFullProgress() | ||
|
||
def test_computed_fields_counts_pick_done(self): | ||
self._update_qty_in_location(self.loc_bin1, self.product1, 20.0) | ||
self._update_qty_in_location(self.loc_bin1, self.product2, 20.0) | ||
self.picking.release_available_to_promise() | ||
pick_picking = self.picking.move_ids.move_orig_ids.picking_id | ||
self._action_done_picking(pick_picking) | ||
|
||
self.channel.invalidate_cache() | ||
self.assertVolume("all", [(self.product1, 5 * 3), (self.product2, 5 * 3)]) | ||
self.assertVolume( | ||
"release_ready", [(self.product1, 5 * 2), (self.product2, 5 * 2)] | ||
) | ||
self.assertVolume("released", [(self.product1, 5), (self.product2, 5)]) | ||
self.assertVolume("assigned", [(self.product1, 5), (self.product2, 5)]) | ||
self.assertVolume("waiting", []) | ||
self.assertVolume("late", [(self.product1, 5), (self.product2, 5)]) | ||
self.assertVolume("late", []) | ||
self.assertVolume("priority", []) | ||
self.assertVolume("done", []) | ||
self.assertVolumeFullProgress() | ||
|
||
self._action_done_picking(picking) | ||
def test_computed_fields_counts_ship_done(self): | ||
self._update_qty_in_location(self.loc_bin1, self.product1, 20.0) | ||
self._update_qty_in_location(self.loc_bin1, self.product2, 20.0) | ||
self.picking.release_available_to_promise() | ||
pick_picking = self.picking.move_ids.move_orig_ids.picking_id | ||
self._action_done_picking(pick_picking) | ||
self._action_done_picking(self.picking) | ||
|
||
self.channel.invalidate_cache() | ||
self.assertVolume("all", [(self.product1, 5 * 3), (self.product2, 5 * 3)]) | ||
self.assertVolume( | ||
"release_ready", [(self.product1, 5 * 2), (self.product2, 5 * 2)] | ||
|