Skip to Content
Odoo Menu
  • Sign in
  • Try it free
  • Apps
    Finance
    • Accounting
    • Invoicing
    • Expenses
    • Spreadsheet (BI)
    • Documents
    • Sign
    Sales
    • CRM
    • Sales
    • POS Shop
    • POS Restaurant
    • Subscriptions
    • Rental
    Websites
    • Website Builder
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Supply Chain
    • Inventory
    • Manufacturing
    • PLM
    • Purchase
    • Maintenance
    • Quality
    Human Resources
    • Employees
    • Recruitment
    • Time Off
    • Appraisals
    • Referrals
    • Fleet
    Marketing
    • Social Marketing
    • Email Marketing
    • SMS Marketing
    • Events
    • Marketing Automation
    • Surveys
    Services
    • Project
    • Timesheets
    • Field Service
    • Helpdesk
    • Planning
    • Appointments
    Productivity
    • Discuss
    • Approvals
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Industries
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Beverage Distributor
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architecture Firm
    • Construction
    • Estate Management
    • Gardening
    • Property Owner Association
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Manufacturing
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware & Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Others
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Community
    Learn
    • Tutorials
    • Documentation
    • Certifications
    • Training
    • Blog
    • Podcast
    Empower Education
    • Education Program
    • Scale Up! Business Game
    • Visit Odoo
    Get the Software
    • Download
    • Compare Editions
    • Releases
    Collaborate
    • Github
    • Forum
    • Events
    • Translations
    • Become a Partner
    • Services for Partners
    • Register your Accounting Firm
    Get Services
    • Find a Partner
    • Find an Accountant
      • Get a Tailored Demo
    • Implementation Services
    • Customer References
    • Support
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +32 2 290 34 90
    • Get a Tailored Demo
  • Pricing
  • Help
  1. APPS
  2. Extra Tools
  3. CRM Team ZIP Assignment v 16.0
  4. Sales Conditions FAQ

CRM Team ZIP Assignment

by Binhex https://github.com/OCA/crm , Odoo Community Association (OCA) https://github.com/OCA/crm
Odoo
v 16.0 Third Party
Download for v 16.0 Deploy on Odoo.sh
Apps purchases are linked to your Odoo account, please sign in or sign up first.
Availability
Odoo Online
Odoo.sh
On Premise
Odoo Apps Dependencies • CRM (crm)
• Calendar (calendar)
• Contacts (contacts)
• Discuss (mail)
Lines of code 247
Technical Name crm_team_zip_assign
LicenseAGPL-3
Websitehttps://github.com/OCA/crm
You bought this module and need support? Click here!
Odoo Community Association

CRM Team ZIP Assignment

Beta License: AGPL-3 OCA/crm Translate me on Weblate Try me on Runboat

Auto-assign CRM teams to partners based on ZIP code patterns using regular expressions.

https://raw.githubusercontent.com/OCA/crm/16.0/crm_team_zip_assign/static/description/crm_team_form_view.png

Features

  • Auto-assign CRM teams to partners based on ZIP code patterns
  • Support for Python regular expressions with validation constraints
  • Multi-company support
  • Geographic filtering by countries and states
  • Priority-based assignment when multiple teams match
  • Exclusion flag for partners who should not be auto-assigned
  • Real-time regex pattern validation prevents invalid patterns
  • Contextual action for manual assignment from partner views
  • Conditional assignment using pre-zip match conditions: teams can specify a domain expression (Odoo domain syntax) that must be satisfied by the partner before ZIP regex matching is performed. This allows for advanced filtering, e.g., only assign if the partner is a company or meets other criteria.

Assignment Logic

The assignment is triggered on partner create/write when ZIP, company, country, state, or exclusion flag changes. A contextual action is also available from partner views for manual assignment. The system:

  1. Finds all active teams with ZIP assignment enabled in the partner’s company
  2. Filters teams by matching countries and states (if specified)
  3. For each eligible team, evaluates the optional pre-zip match condition (Odoo domain expression). If the partner does not satisfy the condition, the team is skipped.
  4. Tests each remaining team’s regex patterns against the partner’s ZIP code
  5. Selects the team with highest priority if multiple matches exist
  6. Logs assignment activity for audit purposes

Assignment Rules

  1. Only active teams with “Active ZIP Assignment” enabled are considered
  2. Only teams in the same company as the partner are considered
  3. Teams must have matching countries (partner’s country must be in team’s countries)
  4. Teams must have matching states (partner’s state must be in team’s states, if team has states defined)
  5. If a team has a pre-zip match condition, the partner must satisfy the condition (Odoo domain) before ZIP regex matching is performed. If not set, all partners are considered.
  6. Partners without a company, ZIP code, country, or state are not assigned
  7. Partners with “Exclude from ZIP Assignment” checked are not assigned
  8. When multiple teams match, the team with highest priority is selected
  9. Invalid regex patterns are prevented by validation constraints at input time

Table of contents

  • Usage

Usage

Setting up CRM Teams

  1. Go to CRM → Configuration → Sales Teams
  2. Edit or create a CRM team
  3. Enable “Active ZIP Assignment” checkbox
  4. Set “ZIP Assignment Priority” (higher number = higher priority)
  5. Configure geographic coverage: - Select “Countries” where this team operates (required) - Select “States” within those countries (required)
  6. Add ZIP patterns in the “ZIP Patterns” tab
  7. (Optional) Set a “Pre-Zip Match Condition” using Odoo domain syntax to restrict assignment to partners matching specific criteria (e.g., only companies, only certain types, etc.)

Geographic Coverage

  • Countries: Teams will only be considered for partners located in the selected countries
  • States: Teams will only be considered for partners in the selected states
  • Domain Filtering: State selection is automatically filtered based on selected countries

Pre-Zip Match Condition

You can further restrict team assignment by specifying a domain condition in the “Pre-Zip Match Condition” field. This uses Odoo’s domain syntax (e.g., [(‘is_company’, ‘=’, True)]). Only partners matching this condition will be considered for ZIP pattern matching for this team.

Pre-Zip Match Condition Examples

Some example domain conditions:

  • [(‘is_company’, ‘=’, True)] — Only assign to partners that are companies
  • [(‘type’, ‘=’, ‘contact’)] — Only assign to contacts
  • [(‘industry_id’, ‘!=’, False)] — Only assign to partners with an industry set

You can combine multiple conditions, e.g. [(‘is_company’, ‘=’, True), (‘country_id’, ‘=’, ref(‘base.us’))]

ZIP Pattern Examples

All patterns are validated in real-time to ensure they are valid Python regular expressions:

  • ^1[0-5].* - ZIP codes starting with 10-15
  • ^2[0-9].* - ZIP codes starting with 20-29
  • ^751.* - ZIP codes starting with 751
  • .*123$ - ZIP codes ending with 123
  • ^[1-3].* - ZIP codes starting with 1, 2, or 3
  • ^(10|20|30).* - ZIP codes starting with 10, 20, or 30

Pattern Validation

The system validates regex patterns when they are entered:

  • Invalid patterns will show an error message immediately
  • Error messages include the specific regex error for debugging
  • Only valid patterns can be saved to the database

Partner Configuration

Partners have an “Exclude from ZIP Assignment” checkbox to prevent automatic assignment.

Teams can have a “Pre-Zip Match Condition” to restrict assignment to partners matching specific criteria before ZIP pattern matching is performed.

Usage

Automatic Assignment

Partners are automatically assigned to CRM teams when:

  • A partner is created with complete geographic information (ZIP, country, state)
  • A partner’s ZIP code is modified
  • A partner’s country or state is changed
  • A partner’s company is changed
  • The exclusion flag is modified

For each team, if a “Pre-Zip Match Condition” is set, the partner must match this condition before ZIP pattern matching is performed. If not set, all partners are considered for ZIP matching.

Manual Assignment

You can also trigger assignment manually:

  • Use the contextual action available in partner views
  • This is useful for reassigning existing partners after updating team configurations or after addon installation

Assignment Requirements

For automatic assignment to work, partners must have:

  • A ZIP code
  • A country
  • A state
  • A company
  • “Exclude from ZIP Assignment” must be unchecked

Bug Tracker

Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us to smash it by providing a detailed and welcomed feedback.

Do not contact contributors directly about support or help with technical issues.

Credits

Authors

  • Binhex

Contributors

  • Adasat Torres de León <a.torres@binhex.cloud>
  • Rolando Pérez Rebollo <r.perez@binhex.cloud>

Maintainers

This module is maintained by the OCA.

Odoo Community Association

OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.

This module is part of the OCA/crm project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

Please log in to comment on this module

  • The author can leave a single reply to each comment.
  • This section is meant to ask simple questions or leave a rating. Every report of a problem experienced while using the module should be addressed to the author directly (refer to the following point).
  • If you want to start a discussion with the author, please use the developer contact information. They can usually be found in the description.
Please choose a rating from 1 to 5 for this module.
Community
  • Tutorials
  • Documentation
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Translations
Services
  • Odoo.sh Hosting
  • Support
  • Upgrade
  • Custom Developments
  • Education
  • Find an Accountant
  • Find a Partner
  • Become a Partner
About us
  • Our company
  • Brand Assets
  • Contact us
  • Jobs
  • Events
  • Podcast
  • Blog
  • Customers
  • Legal • Privacy
  • Security

Odoo is a suite of open source business apps that cover all your company needs: CRM, eCommerce, accounting, inventory, point of sale, project management, etc.

Odoo's unique value proposition is to be at the same time very easy to use and fully integrated.

Website made with