Phase 1 — Quick Wins
These steps stop the immediate validation-error class and clean accumulated debt. None require schema changes; all are reversible.
:::info Prerequisite Phase 0 backups are in place. :::
1.1 Set lock dates
Locking posted periods at the parent company prevents back-dated edits from silently corrupting the date/sequence relationship on already-posted entries.
UI path: Accounting → Settings → Fiscal Periods
Set:
- Lock Date — last day of the most recent closed accounting month
- Tax Lock Date — same, or earlier if BIR returns are still being prepared
Re-run monthly, 3–5 days after period close.
For automation considerations, see Lock Dates.
1.2 Clean stale drafts
There are 53 drafts whose name was assigned in a prior period and now mismatches the entry's date. Each is a future validation-error.
Step 1 — Export for review
COPY (
SELECT m.id, m.name, m.date, j.code AS journal,
c.name AS branch, m.amount_total, m.ref,
u.login AS created_by, m.create_date
FROM account_move m
JOIN account_journal j ON j.id = m.journal_id
JOIN res_company c ON c.id = m.company_id
LEFT JOIN res_users u ON u.id = m.create_uid
WHERE m.state = 'draft' AND m.name <> '/' AND m.name IS NOT NULL
ORDER BY m.date
) TO '/tmp/stale_drafts_baywaters.csv' WITH CSV HEADER;
Hand to accounting team. Each row should be marked keep or discard.
Step 2 — Categorize
After accounting review, split the IDs into two lists:
KEEP_IDS— entries the team still wants to postDROP_IDS— abandoned entries to delete
Step 3 — Clear names on keepers
Run via Odoo shell (not raw SQL — let ORM constraints fire):
python odoo-bin shell -c odoo.conf -d rts_baywaters
KEEP_IDS = [<paste-from-csv-review>]
moves = env['account.move'].browse(KEEP_IDS)
moves.write({'name': '/'})
env.cr.commit()
print(f"Cleared name on {len(moves)} drafts.")
Each will get a fresh date-correct sequence on next post.
Step 4 — Delete abandoned drafts
DROP_IDS = [<paste-from-csv-review>]
moves = env['account.move'].browse(DROP_IDS)
print(f"About to unlink: {moves.mapped('name')}")
moves.unlink()
env.cr.commit()
:::warning Always verify the name list before unlinking
Drafts may have linked attachments, comments, or activity logs. Review the printed names before committing.
:::
1.3 Rename misleading bank journals
Current bank journals are named after fuel-station locations (AUB -PETRON, AUB - CALTEX) but Caltex-side branches post to the Petron-named journal and vice versa. Rename to match the physical bank account, not a location.
UI path: Accounting → Configuration → Journals → BNK1 (or BNK2)
Suggested rename:
| Current | Suggested |
|---|---|
BNK1 "AUB -PETRON" | BNK1 "AUB Operating - 0123456789" (use real account number) |
BNK2 "AUB - CALTEX" | BNK2 "AUB Caltex Operating - 9876543210" (use real account number) |
Important — do this at month-start, after the prior month's bank reconciliation is complete. Mid-month renames don't break anything technically but confuse statement imports.
1.4 Verify the immediate error is resolved
For the original MISC/2026/03/0033 validation error from the user's screenshot:
- Open the entry in Odoo (
Accounting → Journal Entries, search by name) - Click into the Number field, change to
/ - Save
- Click Post — entry will get a fresh April-correct sequence
Or, batch resequence: tree view → select multiple drafts in same period → right-click → Resequence.
Exit criteria for Phase 1
- Lock Date and Tax Lock Date set on Baywaters Corp.
- Stale drafts CSV exported and reviewed by accounting
- KEEP drafts have name cleared (
= '/') - DROP drafts unlinked
- Bank journals renamed
- At least one previously-stuck entry successfully posted
What's next
Once Phase 1 is clean, proceed to sequence settings audit and the structural fix in Phase 4 (per-branch journals).