details:   https://code.tryton.org/tryton/commit/a0ddecb8aec5
branch:    7.8
user:      Cédric Krier <[email protected]>
date:      Thu Mar 26 09:09:00 2026 +0100
description:
        Calculate cached quantities for inactive locations when closing a stock 
period

        Closes #14664
        (grafted from 33b64863cfc720f5f65754f1898a93cf09419d63)
diffstat:

 modules/stock/period.py |  10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diffs (27 lines):

diff -r ffc6f6661762 -r a0ddecb8aec5 modules/stock/period.py
--- a/modules/stock/period.py   Tue Mar 24 16:57:31 2026 +0100
+++ b/modules/stock/period.py   Thu Mar 26 09:09:00 2026 +0100
@@ -9,7 +9,7 @@
 from trytond.pool import Pool
 from trytond.pyson import Eval
 from trytond.tools import grouped_slice
-from trytond.transaction import Transaction
+from trytond.transaction import Transaction, inactive_records
 
 from .exceptions import PeriodCloseError
 
@@ -117,9 +117,11 @@
             with connection.cursor() as cursor:
                 cursor.execute(*query)
 
-        locations = Location.search([
-                ('type', 'not in', ['warehouse', 'view']),
-                ], order=[])
+        with inactive_records():
+            locations = Location.search([
+                    ('type', 'not in', ['warehouse', 'view']),
+                    ],
+                order=[])
 
         for company, c_periods in groupby(periods, key=lambda p: p.company):
             c_periods = list(c_periods)

Reply via email to