Sequences
Odoo 17 uses two distinct sequencing mechanisms for accounting entries. Understanding which is which prevents the date/sequence validation errors that prompted the migration work.
The two sequence systems
1. Move name (primary)
account.move.name is the user-visible journal entry number (e.g., MISC/2026/04/0001). It's computed via Odoo's _get_last_sequence() mechanism on the account.move model itself — not from ir.sequence.
The move name is locked the moment a move is posted (posted_before = True). After that, changing the move's date to a different month/year triggers:
Validation Error The Date doesn't match the sequence number of the related Journal Entry…
This is the error class Phase 1 of the migration addresses.
2. Secure sequence (secondary, for hashing)
When restrict_mode_hash_table = True on a journal, Odoo creates a separate ir.sequence record (visible as "Check Number Sequence") used for tamper-evidence hashing. This is independent of the user-visible move name.
You can see them with:
SELECT id, name, padding, implementation FROM ir_sequence
WHERE name LIKE '%Check Number%';
standard vs no_gap
| Mode | Behavior | When to use |
|---|---|---|
| standard | Numbers may have gaps (e.g., a draft is deleted mid-month) | Default — recommended for most journals |
| no_gap | Guarantees no missing numbers; serializes posting under a row lock | Only when legally required (e.g., specific BIR books for some industries) |
no_gap makes posting slower under concurrency (each post acquires a sequence lock) and amplifies the validation-error class because gaps can't appear naturally — every aborted post costs human cleanup.
Default at YGC: standard. Enable no_gap only on specific journals after written sign-off from accounting/audit.
Date-range (monthly) sequencing
To produce <CODE>/<YYYY>/<MM>/<NNNN> patterns, the journal's primary move sequencing must be date-aware. This is set per-journal — not per-ir.sequence — by Odoo 17's built-in mechanism. You don't usually configure this directly; it's implicit when the move name uses %(range_year)s and %(range_month)s tokens.
How Phase 4 will create per-branch sequences
The branch-journals migration module creates new account.journal records per branch. Odoo auto-seeds the move-name pattern from the journal's code field on first post — so with code = 'PCMSC', the first posted entry will be PCMSC/2026/05/0001 and subsequent entries follow.
No ir.sequence records need to be hand-created.
Resequencing
If you need to renumber a range of moves (e.g., to close a gap or fix a chronology error):
- Open the journal's tree view
- Filter by date range and journal
- Select the moves
- Right-click → Resequence
- In the wizard, pick the start number and confirm
The wizard rewrites name on each move atomically. Use it after the Phase 1 stale-draft cleanup if you want compact numbering on a recently-cleaned month.
:::caution Resequencing is only safe on draft + same-period entries Don't resequence across the lock date or across already-reconciled bank statements. :::