details:   https://code.tryton.org/tryton/commit/33b64863cfc7
branch:    default
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
diffstat:

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

diffs (27 lines):

diff -r 7e7d7774dfba -r 33b64863cfc7 modules/stock/period.py
--- a/modules/stock/period.py   Wed Mar 25 12:53:28 2026 +0100
+++ b/modules/stock/period.py   Thu Mar 26 09:09:00 2026 +0100
@@ -8,7 +8,7 @@
 from trytond.model import Index, ModelSQL, ModelView, Workflow, fields
 from trytond.pool import Pool
 from trytond.pyson import Eval
-from trytond.transaction import Transaction
+from trytond.transaction import Transaction, inactive_records
 
 from .exceptions import PeriodCloseError
 
@@ -113,9 +113,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