| Availability |
Odoo Online
Odoo.sh
On Premise
|
| Odoo Apps Dependencies |
•
Purchase (purchase)
• Sales (sale_management) • Invoicing (account) • Discuss (mail) |
| Lines of code | 68 |
| Technical Name |
contact_role_filter |
| License | LGPL-3 |
| Website | https://www.linkedin.com/in/jmsman3/ |
| Availability |
Odoo Online
Odoo.sh
On Premise
|
| Odoo Apps Dependencies |
•
Purchase (purchase)
• Sales (sale_management) • Invoicing (account) • Discuss (mail) |
| Lines of code | 68 |
| Technical Name |
contact_role_filter |
| License | LGPL-3 |
| Website | https://www.linkedin.com/in/jmsman3/ |
Contact Role-Based Filtering
Odoo 18 Contacts Sales Purchase
A clean, simple module that introduces role-based contact classification so that Sales Orders show only Customers and Purchase Orders show only Vendors — automatically, with no manual filtering required.
Problem This Module Solves
In standard Odoo, all contacts are stored together — Customers, Vendors, Employees, and Others. When a user opens a Sales Order or Purchase Order, the contact dropdown shows everyone, causing:
- Users accidentally selecting a Vendor in a Sales Order
- Users accidentally selecting a Customer in a Purchase Order
- Incorrect reports and financial documents
- Data inconsistency in master records
- Slower workflows and high dependency on user training
Solution
This module adds two simple boolean fields to every contact — Is a Customer and Is a Vendor. Based on these flags:
- Sales Orders automatically show only contacts marked as Customer
- Purchase Orders automatically show only contacts marked as Vendor
- A contact marked as both appears in both modules
- A contact with no role appears in neither
- Creating a contact from Sales auto-sets it as Customer
- Creating a contact from Purchase auto-sets it as Vendor
Visibility Rules
| Contact Role | Visible in Sales | Visible in Purchase |
|---|---|---|
| Customer only | ✔ Yes | ✘ No |
| Vendor only | ✘ No | ✔ Yes |
| Customer + Vendor (Both) | ✔ Yes | ✔ Yes |
| None | ✘ No | ✘ No |
Key Features
- Two new toggle fields on every contact: Is a Customer and Is a Vendor
- Sales Order customer field filters to customers only — automatically
- Purchase Order vendor field filters to vendors only — automatically
- Dual-role contacts (Customer + Vendor) work in both modules
- New contact created from Sales Order auto-gets Customer role
- New contact created from Purchase Order auto-gets Vendor role
- Optional Customer / Vendor columns visible in contact list view
- No manual filters needed — zero technical knowledge required
- Fully independent from Odoo's built-in customer_rank / supplier_rank system
How It Works
- Open any contact record in Odoo Contacts
- Find the new Contact Role section with two toggle switches
- Toggle Is a Customer ON → contact appears in Sales Order dropdown
- Toggle Is a Vendor ON → contact appears in Purchase Order dropdown
- Both can be ON simultaneously for dual-role contacts
- All filtering happens automatically — no manual action required
Dependencies
- sale_management
- purchase
Developed by: Md. Jubaer Mahmud Sarker
LinkedIn:
linkedin.com/in/jmsman3
Please log in to comment on this module