details:   https://code.tryton.org/tryton/commit/e05755a36a07
branch:    8.0
user:      Cédric Krier <[email protected]>
date:      Tue Jun 16 13:19:12 2026 +0200
description:
        Use new non-readonly transaction to create journal-period from opening 
wizard

        Since 088e367462ce the execution of the wizard is on a readonly 
transaction
        which prevents to insert in the database.

        Closes #14894
        (grafted from 2a1ecd1da4a1eca4b01666ff359b7b3424d058bd)
diffstat:

 modules/account/move.py |  15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)

diffs (27 lines):

diff -r 5ceb1986ee75 -r e05755a36a07 modules/account/move.py
--- a/modules/account/move.py   Thu Jun 11 10:37:29 2026 +0200
+++ b/modules/account/move.py   Tue Jun 16 13:19:12 2026 +0200
@@ -2032,14 +2032,17 @@
                 ('period', '=', period.id),
                 ], limit=1)
         if not journal_periods:
-            journal_period, = JournalPeriod.create([{
-                        'journal': journal.id,
-                        'period': period.id,
-                        }])
+            with Transaction().new_transaction():
+                journal_period, = JournalPeriod.create([{
+                            'journal': journal.id,
+                            'period': period.id,
+                            }])
+                name = journal_period.rec_name
         else:
             journal_period, = journal_periods
-
-        action['name'] += ' (%s)' % journal_period.rec_name
+            name = journal_period.rec_name
+
+        action['name'] += ' (%s)' % name
         action['pyson_domain'] = PYSONEncoder().encode([
             ('journal', '=', journal.id),
             ('period', '=', period.id),

Reply via email to