Step-by-Step Guide
First, we explain how to set up the Odoo approval manager sequence in your system. Then, we guide you through each step to build a clear approval workflow. Additionally, we link to the Odoo Documentation for reference. Moreover, this tutorial uses plain language and active voice to help you succeed quickly.
Overview of Odoo Approval Manager Sequence
First of all, the Odoo approval manager sequence lets you define the order of approvers for any request. Consequently, you ensure that a manager reviews a request before anyone else. Moreover, you set a minimum number of approvals to finalize a decision. Therefore, you gain control and traceability over your approval workflow.
In this section, we cover:
- What the approval app does
- How the manager sequence works
- Why you need a clear approval order
What the Approval App Does
The Approvals app in Odoo handles any request that needs sign-off. For example, you can manage:
- Expense reports
- Purchase authorizations
- Custom internal requests
Then, Odoo shows each approver in a list. Next, each approver can approve or reject. Finally, Odoo moves the request to the next person until it closes.
How Manager Sequence Works
First, Odoo reads the approver list and their sequence numbers. Then, it highlights the next approver. Moreover, if you set the minimum approvals to one, any approver can close the request. However, you can enforce a full sequence so that each person must sign in order. Therefore, you get a strict approval workflow.
Why You Need a Clear Approval Order
- You avoid skipped reviews.
- You track who approved and when.
- You comply with audit and control policies.
Moreover, you can use automated actions or custom code to enforce order. We cover both options later.
Prerequisites
First, make sure that you meet these needs:
- You run Odoo 14 or above.
- You have Administrator rights.
- You know how to enable Developer Mode.
- You have the Approvals app installed.
Next, we install and configure the app.
Install and Configure the Approvals App
First, log in as an admin user. Then, follow these steps:
- Click Apps in the top menu.
- Search for Approvals.
- Click Install under the “Approvals” tile.
Next, Odoo adds a new Approvals menu under Employees or Sales (depending on your edition). Then, you can open it to start creating approval types.
Create and Customize Approval Types
First, you define an Approval Type to group requests. Then, you add approvers and set the sequence. Next, you adjust the minimum approval count.
Add a New Approval Type
- Go to Approvals > Configuration > Approval Types.
- Click Create.
- Enter a Name (e.g., “Expense Report”).
- Set Default Responsible if you want one user to manage requests.
- Save the new type.
Add Approvers and Define Sequence
First, click the Approver Entries tab. Then, click Add a line for each approver.
Approver Entries
┌────────────┬──────────┬──────────┐
│ User │ Sequence │ Action │
├────────────┼──────────┼──────────┤
│ Manager │ 1 │ Approve │
│ Dept Head │ 2 │ Approve │
│ CFO │ 3 │ Approve │
└────────────┴──────────┴──────────┘
Next, set the Sequence number to define the order:
- 1 = manager
- 2 = department head
- 3 = CFO
Moreover, Odoo processes approvers by ascending sequence.
Adjust Minimum Approval Settings
First, find the Minimum Approval field. Then, choose how many people must approve before Odoo marks the request as done. For example:
- Set 1 to allow a single approver to close.
- Set 3 to require all three approvers.
However, if you want only the manager to approve first and then stop, set:
- Minimum Approval = 1
- Sequence ensures the manager goes first.
Next, we enforce manager-first if Odoo still lets a later approver sign ahead of time.
Enforce Manager-First Approval Sequence
First, we see that the default app does not block out-of-order approvals. Therefore, we use two methods:
- Automated Actions (no code module)
- Custom Module (Python + XML)
Option 1: Use Automated Actions
First, activate Developer Mode. Then, follow:
- Go to Settings > Technical > Automation > Automated Actions.
- Click Create.
- Set Model to
Approval Request
. - Choose Trigger = On Update of
state
. - Add a Filter:
state
=to_approve
. - In Actions, add a Server Action with Python code:
# Automated Action: Force Manager First
manager = record.request_owner.employee_id.parent_id.user_id
if manager:
# Reset approver lines
new_lines = []
for line in record.request_type_id.approver_line_ids:
# Place manager first
seq = 1 if line.user_id.id == manager.id else line.sequence + 1
new_lines.append((0, 0, {
'user_id': line.user_id.id,
'sequence': seq,
'action': line.action
}))
record.approver_line_ids = new_lines
Then, save the action. Next, each time you submit a request:
- Odoo triggers this action.
- It moves the manager to sequence 1.
- It pushes others down by one.
Option 2: Develop a Custom Module
First, create a module folder named approval_manager_sequence
. Then add these files:
approval_manager_sequence/
├── __init__.py
├── __manifest__.py
└── models/
└── approval_request.py
manifest.py
{
'name': 'Approval Manager Sequence',
'version': '14.0.1.0.0',
'category': 'Tools',
'depends': ['approval'],
'data': [],
'installable': True,
}
models/approval_request.py
from odoo import models, api
class ApprovalRequest(models.Model):
_inherit = 'approval.request'
@api.onchange('state')
def _onchange_state_force_manager(self):
for rec in self:
if rec.state == 'to_approve':
manager = rec.request_owner.employee_id.parent_id.user_id
if manager:
entries = rec.request_type_id.approver_line_ids.sorted('sequence')
new_lines = []
# Always put manager first
new_lines.append((0, 0, {
'user_id': manager.id,
'sequence': 1,
'action': 'approve'
}))
seq = 2
for entry in entries:
if entry.user_id.id != manager.id:
new_lines.append((0, 0, {
'user_id': entry.user_id.id,
'sequence': seq,
'action': entry.action
}))
seq += 1
rec.approver_line_ids = new_lines
Next, install this module. Then, Odoo calls _onchange_state_force_manager
every time the request moves to To Approve. Therefore, the manager always sits at sequence 1.
Test Your Approval Workflow
First, create a test request:
- Go to Approvals > Requests.
- Click New Request.
- Choose your Approval Type.
- Fill Title and Owner, then click Submit.
Next, Odoo submits and runs your automated action or module:
- It shows the manager at the top.
- It locks out other approvers until the manager signs.
Then, log in as the manager:
- Go to My Approvals.
- Click Approve.
Finally, log in as the next approver and finish the process.
Troubleshooting Tips
First, check that you installed the Approvals app. Then, verify that:
- You enabled Developer Mode.
- Your automated action triggers on the right state.
- Your custom module depends on
approval
.
Moreover, you can inspect logs:
- Open the Odoo server console.
- Look for errors in Python code.
- Fix syntax or model names if needed.
Additionally, if your manager field is empty, verify:
- The owner has an employee record.
- The employee has a parent (manager) assigned.
Finally, test edge cases:
- Submit when there is no manager.
- Change the minimum approvals.
- Add or remove approvers to see effects.
Best Practices
First, use clear names for Approval Types. Next, keep the approver list short. Then, set a reasonable Minimum Approval. Moreover, document your automation in Odoo’s Technical Settings. Therefore, any admin can see and update your server actions.
Additionally:
- Version your custom module in Git.
- Review code when you upgrade Odoo.
- Backup your database before big changes.
Finally, train your users to follow the new manager-first flow. That step ensures smooth adoption.
Conclusion
In this tutorial, we set up an Odoo approval manager sequence from scratch. First, we installed and configured the Approval app. Then, we created Approval Types and added sequenced approvers. Moreover, we showed two ways to enforce manager-first approval: Automated Actions and a Custom Module. Finally, we tested and troubleshooted the workflow. Now, you can deliver a clear and secure approval process in Odoo.
If you need more help, visit the Odoo Forum or contact your Odoo partner.
Discover more from teguhteja.id
Subscribe to get the latest posts sent to your email.