Skip to main content

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

  1. All child branches share the parent company's journals (BILL, MISC, BNK1, BNK2, INV). Only STJ (Inventory Valuation) is correctly replicated per company.
  2. Sequence numbers race across branches — when 8+ branches all post to MISC, the date/sequence chronology breaks down.
  3. Two naming conventions coexist on MISC: standard MISC/YYYY/MM/NNNN and custom JV-YYYY-MM-NN from the rts-journal-sequence module.
  4. 53 stale drafts with sequence numbers that no longer match their dates — each one a future validation error.
  5. 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

PhaseScopeRiskEffort
0 — Pre-flightBackup, dependency inventory, branch code map, identify overridesNone (read-only)1–2 hours
1 — Quick winsLock dates, stale draft cleanup, bank journal renamesLow — reversible1 day
2 — Sequence auditReview/adjust per-journal sequence settingsLow0.5 day
3 — Disable JV- override*Stop new entries from getting JV- namingMedium — needs accounting sign-off0.5 day
4 — Replicate journals per branchBuild module to create branch-scoped journalsMedium — ~55 new journals1 day
5 — CutoverInstall branch journals module on chosen dateMedium — coordinated freeze window2–4 hours
6 — Operational rulesTrain users, document monthly lock-date routineNone0.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.

CompanyPrefix
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.