Skip to content

Commit

Permalink
[UPD] tests
Browse files Browse the repository at this point in the history
  • Loading branch information
AungKoKoLin1997 committed Sep 26, 2024
1 parent b457c89 commit 1c77025
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions stock_move_actual_date/tests/test_stock_move_actual_date.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -87,28 +86,26 @@ 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(
scrap.move_id.stock_valuation_layer_ids.account_move_id.date,
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),
Expand All @@ -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,
Expand All @@ -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(
Expand Down

0 comments on commit 1c77025

Please sign in to comment.