Skip to content

Commit 94ec05c

Browse files
authored
Merge pull request #4932 from coopiteasy/14.0-ou_fix-account-post_bank_statements
[14.0][OU-FIX] fix posting bank statements
2 parents ba4fb21 + 61e74cd commit 94ec05c

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

openupgrade_scripts/scripts/account/14.0.1.1/post-migration.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,15 @@ def post_statements(env):
335335
""",
336336
)
337337
stmt_ids = list({x[0] for x in env.cr.fetchall()})
338-
env["account.bank.statement"].browse(stmt_ids).button_post()
338+
# calling .button_post() on all statements together fails with:
339+
# File "/odoo_env/src/odoo/addons/account/models/account_move.py", line 1842, in _check_unique_sequence_number # noqa: B950
340+
# raise ValidationError(_('Posted journal entry must have an unique sequence number per company.\n' # noqa: B950
341+
# odoo.exceptions.ValidationError: Posted journal entry must have an unique sequence number per company. # noqa: B950
342+
# Problematic numbers: 198/100, 198/100, 198/104, 198/104, 198/101, 198/101, 198/102, 198/103, 198/103, 198/102 # noqa: B950
343+
# instead, call it one by one.
344+
stmts = env["account.bank.statement"].browse(stmt_ids)
345+
for stmt in stmts:
346+
stmt.button_post()
339347

340348

341349
def pass_bank_statement_line_note_to_journal_entry_narration(env):

0 commit comments

Comments
 (0)