Studio Approval Automatic Revoke
Studio Approval Automatic Revoke extends the native Odoo 18 Enterprise Studio Approval mechanism by automatically revoking previously granted approvals whenever a configured button is executed. This ensures that temporary approvals remain valid only until the intended business action is completed, preventing users from reusing old approvals indefinitely. The implementation is designed as a lightweight extension that integrates seamlessly with Odoo Studio while maintaining excellent performance, scalability, and upgrade compatibility.
๐ Execution Flow
- Administrator enables Revoke Approval for any Buttons or Actions.
- User requests approval and receives authorization.
- User performs the approved action.
- The frontend detects the configured button.
- The current record is automatically saved if required.
- A lightweight ORM RPC calls the revoke service.
- Matching approval entries are removed.
- The original Odoo button action executes normally.
- If the user needs to perform the protected operation again, a fresh approval request is required.
โ๏ธ Backend Model Design
The module introduces a dedicated configuration model studio.approval.revoke that stores revoke mappings independently from Odoo Studio Approval Rules. It acts only as a lightweight configuration layer, keeping business models completely untouched.
- Dedicated configuration model with minimal fields.
- Indexed fields (model_name, method, action_id, active) provide efficient lookups.
- No computed fields.
- No onchange methods.
- No stored dependencies.
- No inheritance of business models.
- Configuration remains isolated from business documents.
๐ Query Optimization
- Frequently searched columns are indexed.
- Uses highly selective ORM domains.
- limit=1 is used wherever only one configuration record is expected.
- No expensive joins or aggregation queries.
- Approval entry searches filter by Model, Rule and Record ID.
- Configuration lookups remain extremely fast even as business data grows.
๐ Controller Architecture
Instead of replacing Web Studio behaviour, the module extends WebStudioController by introducing a single custom operation: enable_revoke_approval. This approach follows Odoo's extension architecture and minimizes maintenance effort during upgrades.
- No override of Studio's primary editing workflow.
- No duplication of existing controller logic.
- Uses Studio's native operation dispatch mechanism.
- Responsible only for applying revoke metadata to XML views.
- Minimal impact on future Studio updates.
โก Batched Service Optimization
The module includes a custom batched service for get_revoke_spec(). Instead of sending multiple RPC requests while Studio loads several configured buttons, requests are automatically grouped into a single ORM call.
- Combines multiple frontend requests into one RPC.
- Reduces unnecessary network traffic.
- Improves Studio sidebar responsiveness.
- Eliminates duplicate requests during rendering.
- Uses Deferred synchronization similar to Odoo's own batching strategy.
- Scales efficiently for large Studio forms containing many buttons.
๐ Upgrade & Maintainability
- Extends WebStudioController without replacing its core workflow.
- Patches only ViewButton and Studio sidebar components.
- Uses Odoo's official patch mechanism.
- No override of business models.
- No override of ORM methods such as create(), write(), unlink(), read(), or search().
- Minimal impact during future Odoo upgrades.
- Each component has a single responsibility (Model, Controller, Service and Frontend Patch), making the module easy to maintain.
๐ง Frontend Patch Design
The frontend extends only ViewButton, which is the exact execution point for button actions. This allows approval cleanup to occur immediately before the original business operation without altering normal Odoo behaviour.
- Only configured buttons execute additional logic.
- Standard Odoo buttons remain completely unaffected.
- Automatically saves unsaved records before revoking approvals.
- Uses ORM service for secure server communication.
- Returns execution to super.onClick(), preserving native functionality.
- Includes error handling to prevent unexpected frontend failures.
โก Performance Analysis
- ๐ข CPU Usage : Very Low
- ๐ข Memory Usage : Negligible
- ๐ข Database Load : Very Low
- ๐ข No background workers.
- ๐ข No scheduled jobs.
- ๐ข No continuous monitoring processes.
- ๐ข Standard Odoo operations remain completely unaffected.
๐ฆ Database Impact
Every configured button click performs approximately:
โ
Approval Entry Search
โ
Approval Revoke
โ
Original Button Execution
- Only two lightweight searches.
- One targeted Revoke operation.
- No loops across business records.
- No recursive processing.
- No XML regeneration.
- No view rebuilding.
- No computed field recalculation.
- No writes on business documents.
- Database workload remains extremely small.
๐ Scalability
The implementation performs constant-time configuration lookups and highly selective approval searches. Runtime complexity depends only on the clicked record rather than the total number of business records.
- Suitable for enterprise production environments.
- Supports MoreThan 200 of concurrent users.
- Performs efficiently with databases containing hundreds of thousands of business records.
- Indexed lookups prevent unnecessary full table scans.
- Performance remains stable regardless of Sales Orders, Purchase Orders or Manufacturing Orders volume etc,...
๐งพ Final Technical Conclusion
- โ Lightweight extension of Odoo Studio Approval Rules.
- โ Automatic cleanup of temporary approval entries.
- โ Optimized database queries using indexed fields.
- โ Batched frontend service minimizes RPC traffic.
- โ Minimal CPU, memory and database overhead.
- โ No impact on standard business workflows.
- โ Upgrade-friendly architecture using Odoo extension points.
- โ Safe for large-scale Enterprise production deployments.
Steps To Configure: Approval Revoke
Step 1
Step 2
Please log in to comment on this module