Multi-Branch Journal Cleanup — Overview
Background
The Baywaters database (rts_baywaters) is configured as a parent company Baywaters Corp. with 11 child companies (branches). The current state has architectural issues that produce recurring validation errors during posting:
Validation Error The Date (04/17/2026) doesn't match the sequence number of the related Journal Entry (MISC/2026/03/0033) You will need to clear the Journal Entry's Number to proceed.
Root cause
- All child branches share the parent company's journals (BILL, MISC, BNK1, BNK2, INV). Only
STJ(Inventory Valuation) is correctly replicated per company. - Sequence numbers race across branches — when 8+ branches all post to MISC, the date/sequence chronology breaks down.
- Two naming conventions coexist on MISC: standard
MISC/YYYY/MM/NNNNand customJV-YYYY-MM-NNfrom therts-journal-sequencemodule. - 53 stale drafts with sequence numbers that no longer match their dates — each one a future validation error.
- No lock dates at the parent company allow back-dated edits to silently break sequences.
See Phase 0 — Pre-flight for the detailed findings.
Strategy
Cutover model. Leave existing posted moves untouched (audit trail integrity). Create new per-branch journals effective from a chosen cutover date. Existing journals remain at the parent for the parent's own ops.
Phases
| Phase | Scope | Risk | Effort |
|---|---|---|---|
| 0 — Pre-flight | Backup, dependency inventory, branch code map, identify overrides | None (read-only) | 1–2 hours |
| 1 — Quick wins | Lock dates, stale draft cleanup, bank journal renames | Low — reversible | 1 day |
| 2 — Sequence audit | Review/adjust per-journal sequence settings | Low | 0.5 day |
| 3 — Disable JV- override* | Stop new entries from getting JV- naming | Medium — needs accounting sign-off | 0.5 day |
| 4 — Replicate journals per branch | Build module to create branch-scoped journals | Medium — ~55 new journals | 1 day |
| 5 — Cutover | Install branch journals module on chosen date | Medium — coordinated freeze window | 2–4 hours |
| 6 — Operational rules | Train users, document monthly lock-date routine | None | 0.5 day |
Total: ~4 working days + 1 cutover window.
Cutover strategy
Pick the 1st of an upcoming month as the cutover. Old journals freeze at end of prior month; new branch journals start fresh. This avoids:
- Mid-month sequence gaps
- Mixed-pattern journal entries within a single period
- Audit confusion at month-end close
Branch code map
Two-letter prefixes for new per-branch journal codes. Odoo's account.journal.code is varchar(5), so codes use a 2-char prefix + 3-char suffix with no separator: SSINV, SSBIL, SSMSC, SSCSH.
| Company | Prefix |
|---|---|
| Baywaters Corp. (parent) | (no prefix — keep existing) |
| Shawarma Shacks (Petron) | SS |
| Jamaican Patties (Petron) | JP |
| Miguelitos Ice Cream (Petron) | MI |
| Auntie Annes (Petron) | AA |
| Bibingkinitan (Caltex) | BB |
| Jamaican Patties (Caltex) | JC |
| Henlin (Caltex) | HN |
| Potato Corner (Caltex) | PC |
| Sam's Everything on Stick (Caltex) | SC |
| Buko Juan (Petron) | BJ |
| Sams Everything on Sticks (Petron) | SE |
Per branch: <XX>INV, <XX>BIL, <XX>MSC, <XX>CSH. Bank journals stay shared at the parent.
Rollback posture
- Phase 1: stale-draft cleanup is the only step requiring care — always export to CSV first.
- Phases 2–4: all reversible by archiving (
active = false) — no data loss. - Phase 5: cutover can be paused; old journals stay live at the parent so users can keep posting there if branch journals fail smoke tests.