Trash bin and automated retention purges
Soft-delete trash protection, 30-day retention policies, role-restricted restoration, and automated scheduled purge cron jobs.
1. Overview & Business Value#
This comprehensive operational guide details the architecture, business workflows, configuration parameters, and execution steps for Trash bin and automated retention purges within SmartERP.
Accidental document deletion can disrupt ongoing projects or destroy legal audit compliance. SmartERP Documents Enterprise provides a soft-delete Trash Bin mechanism coupled with automated retention enforcement.
{screenshot:trash-bin-and-retention-overview-dashboard}
2. Prerequisites & Security Access Groups#
- Required Modules:
documents, smarterp_dms - Security Groups:
Documents User(Technical ID:documents.group_documents_user)Documents Administrator(Technical ID:documents.group_documents_manager)
- Master Data Dependencies: Workspace hierarchies, document tags, automated actions, OCR rule definitions, and retention policies.
3. Step-by-Step Configuration & Execution#
Step 1: Navigating to the Module Interface#
- Log into your SmartERP instance at
https://smarterp.et/odoo. - Open the main App Switcher (grid icon in the top-left corner).
- Select the Documents app icon.
- From the top navigation bar, open Documents → Workspaces → Finance / Legal / HR / Operations.
{screenshot:trash-bin-and-retention-app-switcher-navigation}
Step 2: Creating and Parameterizing Records#
- Click the New button in the top-left control panel.
- Complete the mandatory fields in the record form:
- Document Title (Mandatory): Clear descriptive document name
- Workspace Category (Mandatory): Target departmental archive workspace
- Attachment File (Mandatory): Uploaded PDF, image, spreadsheet, or scan file
- Document Owner (Mandatory): Employee or department responsible for custody
- Configure optional operational parameters and localized tags as required:
- Document Tags (Optional): Tax, audit, or confidentiality classification labels
- Facial/OCR Extraction Template (Optional): Automated field mapping profile
- Expiry Date (Optional): Statutory document retention expiration date
- Click the Save icon in the control bar to commit the record.
{screenshot:trash-bin-and-retention-record-creation-form}
Step 3: Validating and Processing Transactions#
- State Transitions: Execute operational state progression (Uploaded → Indexed / OCR Processed → Tagged → Approved / Locked → Archived).
- Ledger & System Impact: Document metadata tags and financial attachments link directly to general ledger journal items and vendor bills for instant audit recall.
- Audit Verification: Automated recording of author ID, timestamp, and immutable revision history.
{screenshot:trash-bin-and-retention-transaction-processing-state}
Soft-delete trash architecture#
When a document is deleted by an authorized user:
- It is not immediately removed from the PostgreSQL database or file storage.
- The document is flagged with
is_trash = Trueand timestamped withtrash_date = fields.Datetime.now(). - The document is immediately hidden from standard workspace views, search results, and API endpoints.
- It moves to the Trash Bin view, accessible only to workspace managers and administrators.
Restoring deleted documents#
To restore a soft-deleted document:
- Navigate to Documents $\rightarrow$ Configuration $\rightarrow$ Trash Bin.
- Select the document or batch of documents to recover.
- Click Actions $\rightarrow$ Restore from Trash.
- The document is restored to its original workspace with all tags, version history, and attachments intact.
Automated retention purges (Cron)#
To prevent unbounded storage growth while ensuring compliance:
- Default Retention Window: Documents remain in the Trash Bin for 30 calendar days.
- Automated Purge Cron: An automated background cron job (
documents_trash_purge_cron) runs nightly. - Permanent Purge: Documents that have resided in the Trash Bin for longer than the configured retention threshold are permanently deleted, freeing disk space and removing database references.
4. Advanced Configuration Points#
- Automated Actions & Scheduled Tasks (Crons):
Documents: Run OCR field extraction(documents.ir_cron_ocr_process): Runs every 15 minutes to process incoming scanned document textDocuments: Archive expired records(documents.ir_cron_retention): Runs weekly to enforce statutory document retention schedules
- Custom Print Templates & Reports:
- Document Audit Trail & Access Log
- Workspace Document Storage & Activity Ledger
- Multi-Company Rules: Record-level security isolation under Company 1 (
Ashewa Technology Solutions S.C.), preventing cross-company ledger leakage across parent and subsidiary legal entities.
5. Comprehensive Troubleshooting Matrix#
| Error Symptom / Exception | Probable Root Cause | Corrective Action / Resolution |
|---|---|---|
Access Rights Error: Workspace access restricted | User lacks permissions for confidential legal or HR workspace. | Request workspace access clearance from Documents Administrator. |
OCR Extraction Failure: Low scan resolution | Scanned image DPI is below minimum threshold for optical character recognition. | Upload document at minimum 300 DPI resolution with clear contrast. |
Upload Blocked: File size exceeds maximum limit | File exceeds system maximum attachment size. | Compress file or upload via secure external cloud link. |