details:   https://code.tryton.org/tryton/commit/1d136af84d80
branch:    default
user:      Cédric Krier <[email protected]>
date:      Mon Oct 05 13:03:52 2026 +0200
description:
        Move tests about stock period closed in scenario

        4ab7b9eb0ef5 added a scenario which could replace the checks in 
test_period.
diffstat:

 modules/stock/tests/scenario_stock_period.rst |   8 ++++++
 modules/stock/tests/test_module.py            |  31 +--------------------------
 2 files changed, 9 insertions(+), 30 deletions(-)

diffs (63 lines):

diff -r 9cf089215d53 -r 1d136af84d80 
modules/stock/tests/scenario_stock_period.rst
--- a/modules/stock/tests/scenario_stock_period.rst     Mon Oct 05 12:54:17 
2026 +0200
+++ b/modules/stock/tests/scenario_stock_period.rst     Mon Oct 05 13:03:52 
2026 +0200
@@ -138,3 +138,11 @@
     Traceback (most recent call last):
         ...
     PeriodCloseError: ...
+
+Try to close a period in the future::
+
+    >>> period = Period(date=today + dt.timedelta(days=2))
+    >>> period.click('close')
+    Traceback (most recent call last):
+        ...
+    PeriodCloseError: ...
diff -r 9cf089215d53 -r 1d136af84d80 modules/stock/tests/test_module.py
--- a/modules/stock/tests/test_module.py        Mon Oct 05 12:54:17 2026 +0200
+++ b/modules/stock/tests/test_module.py        Mon Oct 05 13:03:52 2026 +0200
@@ -12,8 +12,7 @@
     CompanyTestMixin, PartyCompanyCheckEraseMixin, create_company, set_company)
 from trytond.modules.party.tests import PartyCheckReplaceMixin
 from trytond.modules.stock.exceptions import (
-    LocationValidationError, MoveOriginWarning, PeriodCloseError,
-    ProductStockWarning)
+    LocationValidationError, MoveOriginWarning, ProductStockWarning)
 from trytond.pool import Pool
 from trytond.tests.test_tryton import ModuleTestCase, with_transaction
 from trytond.transaction import Transaction, check_access
@@ -958,34 +957,6 @@
 
                 test_products_by_location()
 
-            # Test check_period_closed
-            moves = Move.create([{
-                        'product': product.id,
-                        'unit': unit.id,
-                        'quantity': 10,
-                        'from_location': supplier.id,
-                        'to_location': storage.id,
-                        'planned_date': today,
-                        'effective_date': today,
-                        'company': company.id,
-                        'unit_price': Decimal('1'),
-                        'currency': currency.id,
-                        }])
-            Move.do(moves)
-
-            # Test close period check
-            period, = Period.create([{
-                        'date': today,
-                        'company': company.id,
-                        }])
-            self.assertRaises(PeriodCloseError, Period.close, [period])
-
-            period, = Period.create([{
-                        'date': today + relativedelta(days=1),
-                        'company': company.id,
-                        }])
-            self.assertRaises(PeriodCloseError, Period.close, [period])
-
     @with_transaction()
     def test_check_origin(self):
         'Test Move check_origin'

Reply via email to