diff --git a/stock_move_actual_date/tests/test_stock_move_actual_date.py b/stock_move_actual_date/tests/test_stock_move_actual_date.py index 065f76741242..5a033c823cc2 100644 --- a/stock_move_actual_date/tests/test_stock_move_actual_date.py +++ b/stock_move_actual_date/tests/test_stock_move_actual_date.py @@ -29,7 +29,6 @@ def setUpClass(cls): ) cls.supplier_location = cls.env.ref("stock.stock_location_suppliers") cls.stock_location = cls.env.ref("stock.stock_location_stock") - cls.env.user.tz = "Asia/Tokyo" def create_picking(self, actual_date=False): receipt = self.env["stock.picking"].create( @@ -87,20 +86,17 @@ def test_stock_move_actual_date(self): self.assertEqual( move.stock_valuation_layer_ids.account_move_id.date, date(2024, 9, 1) ) - # Update actual_date after done receipt.actual_date = date(2024, 8, 1) self.assertEqual(move.actual_date, date(2024, 8, 1)) self.assertEqual( move.stock_valuation_layer_ids.account_move_id.date, date(2024, 8, 1) ) - # Create scrap scrap = self.create_scrap(receipt, date(2024, 9, 10)) self.assertEqual(scrap.move_id.actual_date, date(2024, 9, 10)) self.assertEqual( scrap.move_id.stock_valuation_layer_ids.account_move_id.date, date(2024, 9, 10), ) - # Update actual_date after done scrap.actual_date = date(2024, 8, 11) self.assertEqual(scrap.move_id.actual_date, date(2024, 8, 11)) self.assertEqual( @@ -108,7 +104,8 @@ def test_stock_move_actual_date(self): date(2024, 8, 11), ) - # Test inventory adjustment with actual date + def test_inventory_adjustment_actual_date(self): + _, _ = self.create_picking() inventory_quant = self.env["stock.quant"].search( [ ("location_id", "=", self.stock_location.id), @@ -117,7 +114,7 @@ def test_stock_move_actual_date(self): ) inventory_quant.inventory_quantity = 20.0 inventory_quant.accounting_date = date(2024, 7, 1) - inventory_quant.action_apply_inventory() + inventory_quant._apply_inventory() move = self.env["stock.move"].search( [("product_id", "=", self.product_1.id), ("is_inventory", "=", True)], limit=1, @@ -129,6 +126,7 @@ def test_stock_move_actual_date(self): @freeze_time("2024-09-20 23:00:00") def test_stock_move_without_actual_date_from_picking_or_scrap(self): + self.env.user.tz = "Asia/Tokyo" receipt, move = self.create_picking() self.assertEqual(move.actual_date, date(2024, 9, 21)) self.assertEqual(