Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

1

Making phone a unique filed without list import issues?

By
John Baldwin
on 1/17/15, 10:01 PM 649 views

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.

1
Michael Watchorn
On 1/17/15, 10:18 PM

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.

John Baldwin
on 1/18/15, 11:40 AM
0
IT Libertas
On 7/13/16, 8:43 AM

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

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 1/17/15, 10:01 PM
Seen: 649 times
Last updated: 7/13/16, 8:43 AM