From 10e4d29612629b8e03b7e1bdaacac8cf5bd279a1 Mon Sep 17 00:00:00 2001 From: Don Kendall Date: Sat, 19 Sep 2026 21:25:18 -0400 Subject: [PATCH] [FIX] account: year-range sequences with asymmetric year widths `_validate_fiscalyear_difference` truncates the incremented start year to `len(start_year)` before comparing it against the parsed end year. When the two year components have different widths -- `JRNL/2015-16/00001`, the common short-form fiscal-year notation -- that compares a four-digit year against a two-digit one, never matches, and the name stops being recognised as a year-range sequence. On an existing `JRNL/2015-16/` journal the next move in the following period is then numbered `JRNL/2015-16/00003` instead of rolling over to `JRNL/2016-17/00001`, and the next year produces a malformed `JRNL/2015-17/00001`. The inline expression this method was extracted from in 19.0 truncated to `len(year_end)`, which is the operand the result is compared against. Restore that operand. Symmetric formats (`2015-2016`, `15-16`) were unaffected, which is why only one of the twelve cases in `TestSequenceMixin.test_journal_sequence_format` fails. Introduced in c9103a6a10b8 (odoo/odoo#270582). Assisted-by: Claude Opus 5 --- addons/account/models/sequence_mixin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account/models/sequence_mixin.py b/addons/account/models/sequence_mixin.py index 76c44f6071a9ef..4798a1b27fc9cf 100644 --- a/addons/account/models/sequence_mixin.py +++ b/addons/account/models/sequence_mixin.py @@ -225,7 +225,7 @@ def _deduce_sequence_number_reset(self, name): )) def _validate_fiscalyear_difference(self, start_year, end_year): - return self._truncate_year_to_length(int(start_year) + 1, len(start_year)) == int(end_year) + return self._truncate_year_to_length(int(start_year) + 1, len(end_year)) == int(end_year) def _make_regex_non_capturing(self, regex): r""" Replace the "named capturing group" found in the regex by