Contributors mailing list archives
contributors@odoo-community.org
Browse archives
Partner unicity
by
Alexinux, Alexis de Lattre
Dear OCA friends,
As you know, it is often difficult to keep a database without duplicate entries in the partner table. Odoo users often create a new customer/supplier in the database without prior search to see if this customer/supplier already exists. I know that the CRM module has a tool to merge partners, but I'd like to work on technical solutions that would help prevent duplicates, instead of trying to fix them after they occur. I'm not trying to find a perfect solution that avoid all duplicates because I think it's impossible, but I'd like to find pragmatic solutions that would block as many duplicates as possible.Would add an sql constraint on the email field. To make it more efficient, this module could also inherit create to strip() and lower() the email field, so that the constraint is more efficient.
* partner_mobile_unique :
Would add an sql constraint on the mobile field. To make it more efficient, it would depend on base_phone, so that we are sure that the phone fields are "clean" and written in the standard E.164 format (+33 4 72 08 08 87).
Obviously, it is not possible to put a unique constraint on the phone nor fax field (in the same company/family, several people may share the same fixed phone or fax number). It would also be stupid to put a constraint on the name field, as several people can have the same name.
SQL constraint should certainly include the 'company_id' field (i.e. "unique(email, company_id)"), because, in multi-company environments, partners are sometimes not shared between companies.
All ideas and experiences are welcomed before I start to write modules on this topic. I haven't searched deeply if there are existing OCA modules on this topic, so please mention them if you know some.
Regards,
--
Alexis de Lattre
Akretion France - 35B rue Montgolfier - 69100 Villeurbanne - France
Akretion France - 35B rue Montgolfier - 69100 Villeurbanne - France
Follow-Ups