Global Lock Period
Lock any date field, on any model, during any period — including its lines, its status changes, and everything else that comes with it.
Why you need it
At month-end or year-end closing, regular users can still create or backdate documents — Sale Orders, Invoices, Stock Moves, Timesheets, anything with a date — into a period that should already be closed. Worse, a document dated inside a closed period can often still be reset to draft and its lines or amounts edited, even if its date itself is never touched. Global Lock Period stops all of that, generically, on any model, without touching a single line of code per document type.
Works on Any Model
Protects any Date or Datetime field on any standard or custom model — Sale, Purchase, Invoicing, Inventory, Timesheets, or your own apps. No per-model configuration required.
Protects the Whole Record
Optionally lock down the entire document once its date falls inside the period — blocking "Set to Draft", status changes, and any field edit, not only the date field itself.
Cascades to Lines
Editing an Invoice Line or Order Line doesn't call the parent record's write — Odoo writes the line model directly. Global Lock Period follows that link automatically and protects the lines too.
Users & Group Exceptions
Grant bypass access per individual user or per security group — for example, let Accounting Advisors post corrections while everyone else stays locked out.
Two Enforcement Modes
Restrict hard-blocks the create/write/delete with a clear error message. Allow & Log lets the change through but records it for later review.
Full Audit Log
Every blocked or logged attempt is recorded with user, date/time, model, record, operation (Create/Write), field(s), and the attempted value — even when the transaction itself is rolled back.
Three Layers of Protection
1. The Locked Field Itself
Creating or editing a record with its date set inside the locked period is blocked immediately, whichever user or screen it comes from — forms, imports, or automations.
2. The Whole Record
Enable Protect Whole Record to also stop any other change once the date is already inside the period — including clicking "Set to Draft" and editing amounts.
3. Its Lines
Add the related line model (e.g. Invoice Lines) under Protected Child/Line Models and the link field is auto-detected, so adding, editing or deleting a line is blocked too.
See It In Action
1. Configure the Lock
Define the period, pick the model and date field to protect, choose enforcement, and enable Protect Whole Record.
2. Protect Its Lines Too
Add the line model (e.g. Sales Order Line) — the link field back to the parent is auto-detected for you.
3. Blocked on Create
Creating a new Sale Order dated inside the lock period is rejected immediately with a clear message.
4. Whole Record Frozen
Once locked, the entire document is protected — here, a posted Journal Entry can't be touched at all, even to reset it to draft.
5. Lines Protected Too
Even without touching the date, changing a line's quantity on a locked Sale Order is blocked — the cascading child-model protection at work.
6. Review the Audit Trail
Every blocked attempt is recorded with user, model, record, operation, the field(s) involved, and the attempted value.
Built for compliance-minded teams
No JavaScript hacks, no per-document customization: the lock is enforced at the ORM level so it applies consistently everywhere a record is created, written, or deleted — including imports, automations, and server actions.
Please log in to comment on this module