My Odoo Journey - Enforcing Unique Field Values Ain't Easy

My Odoo Journey - Enforcing Unique Field Values Ain't Easy

Here's another roadblock in our journey that has caused us to take an Odoo Pitstop: the need to enforce unique values in certain fields.



The Roadblock:

If you run a business with lots of products and customers, you know how important it is to not have duplicates. This is where enforcing certain fields to only allow unique values comes into play. Some key areas where the ability to enforce unique values are:


  • Customer Contacts. Especially emails of individuals associated to a company. We add dozens of new contacts per day, and it is important we don't duplicate them (for history/profiling/marketing), yet also have the capability to allow duplicates if the same email is used other more than one customer (if you're in B2B, you know what I mean!). But it is currently too easy to duplicate contacts in Odoo. Thankfully, there is the Data Cleaning app that lets you setup rules to detect for similarities, have it email you whenever duplicates are detected, with the option to merge them.


As a workaround, we use the Data Cleaning app to detect duplicates and email us with a notification


  • Purchase Order Numbers. Or what Odoo calls client_order_ref. This is used to reference the customer's purchase orders. If you're in B2B, you know your customers don't care about the SO# you generate. They live and die by their own PO#. This is why the ability to enforce a unique value, but based on the customer (so the same PO# can happen, if added to orders of different customers). This ensures a clear reference with the customer, and helps our team from mistakenly entering duplicate orders.


  • Product Name or Default Code. Unique product names and codes are paramount in a business when you've got thousands of products. From product creation to order entry to website pages, everything relies on unique product names. It would be super helpful to have the ability to make these fields enforce unique values as well.



The Solution

The ability to enforce unique values needs to be at least two-layered.

  • Layer 1: Enforce unique for a specific field
  • Layer 2: Ability to add criteria to enforce unique values for Layer 1 if Layer 2 criteria is met

For example, enforce unique value for the PO# field on a sales order. But only enforce if the PO# is a duplicate under the same customer the order is being created for.


We were lucky to find this amazing third party app Unique Custom Values for Any Model which works exactly the way we need, in a very user-friendly way. The developer Carlos was super responsive when we inquired, which is an absolute plus!


Credit: Bitodoo.com


While there are quite a few third party apps to solve this problem, I really think something important like unique field value enforcement shouldn't require users to go searching beyond OOTB (and a quick Google search confirms that many users face the same problem). We hope that such a useful feature will be included in the future, one that requires no coding knowledge to enable.


Jakub Smolka

ERP System Odoo Professional ?? Co-founder at Origamis

6 个月

Agreed that some things should be preferably OOTB, but I always enjoy a a good generic 3rd party module, which can be flexibly configured. Brilliant recommendation, I did not know this one, but love it from the descriptions... Might very soon use it :-)

要查看或添加评论,请登录

社区洞察

其他会员也浏览了