If I make the field phone unique via sql_constraints in res.partner and crm.leads, what will happen if I attempt to import a list that has one or more existing leads/customers phone numbers in it? Will this throw an error or skip the record all together? If so is there a simple work around for this? The deduplicate leads module does not include phone numbers and I can't imagine why? Does any company in the world want multiple leads/customers with the same phone number?
I am playing wirth this now and thought I should ask before making the changes and wasting my time creating another issue.
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Бухоблік
- Склад
- PoS
- Project
- MRP
Це запитання позначене
To quote the ever knowledgable Ray Carnes:
If there is already data in the system that violates the constraint, it won't work - because it can't be applied.
The constraint has to be for all records - those that already exist, those that will be added via your module, and those that will be added by other modules.
See this link on the forum to see this in context. Where kaynis was having a problem with his constraint.
Your answer was spot on! Thanks! After further thinking this through I can see a huge problem with making phone a unique field. Importing leads list will break the import if you get a duplicate phone number. A better approach is to import leads leaving assignment as unassigned then to run a check against the phone numbers in crm (for duplicate leads) and res.partner (for existing customers). Additionally by setting up a "Do not call" field boolean I can use invisible to hide the phone field on records that are marked "Do not Call." For my purposes the deduplicate leads part of crm is useless, so I'm working on code to filter the duplicates by existing phone numbers in crm & res,partner and marking them as duplicate leads for review by a manager, who can then mark them dead with the reason duplicate.
This app - https://apps.odoo.com/apps/modules/9.0/crm_duplicates/ - let make any field unique for partners, leads and opportunities. Odoo would not allow making duplicates
Enjoying the discussion? Don't just read, join in!
Create an account today to enjoy exclusive features and engage with our awesome community!
Реєстрація
I think there are many use cases where a phone number can be duplicate.
Example 1 : If one of your contact moves from one company to another, you will have to create them as a new contact under new company as you don't want to carry forward any data of that contact from previous company to new company
Example 2: One individual owns two company (legal entity with different tax ID) and that individual is reachable on same number for both company.
There could be many such scenarios, hence by default the phone number can not be made unique for all the Odoo Implementations