From 6ce95dc4b9e64fad3292e01ccfc39428ee596e3d Mon Sep 17 00:00:00 2001 From: Aurelien BOURGEOIS Date: Fri, 24 Jul 2026 11:02:07 +0200 Subject: [PATCH] [OU-IMP] account: create batch payment sequence --- .../scripts/account/18.0.1.3/post-migration.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/openupgrade_scripts/scripts/account/18.0.1.3/post-migration.py b/openupgrade_scripts/scripts/account/18.0.1.3/post-migration.py index 7e0e6a125c57..eeb25d7835f8 100644 --- a/openupgrade_scripts/scripts/account/18.0.1.3/post-migration.py +++ b/openupgrade_scripts/scripts/account/18.0.1.3/post-migration.py @@ -208,12 +208,29 @@ def _handle_outstanding_accounts(env): ) +def _create_batch_payment_sequence(env): + """Creates a Batch Payment Number Sequence for every company that does not + have one yet. This covers companies that existed before the ``account`` + module was installed. + + From https://github.com/odoo/odoo/pull/273905. + The sequence is now created when installing the module, but still isn't when + migrating from a lower version. + This causes errors after migration when making a batch payment. + """ + to_create_seqs = env["res.company"].search( + [("batch_payment_sequence_id", "=", False)] + ) + to_create_seqs._create_batch_payment_sequence() + + @openupgrade.migrate() def migrate(env, version): handle_lock_dates(env) link_payments_to_moves(env) account_account_code_fields(env) _handle_outstanding_accounts(env) + _create_batch_payment_sequence(env) openupgrade.m2o_to_x2m( env.cr, env["account.account"], "account_account", "company_ids", "company_id" )