Odoo Help


How to set partner name unique only if is_company field is true?

on 8/1/13, 3:21 AM 2,603 views

That is when creating new customer / supplier, and set to be a company, how to check the partner name to be unique.

When it is not a company, the customer or supplier, i.e. contacts can have same name.

More generally, how to set one column name to be unique while another or other columns have a specified value.

Somes company can have the same name, but it's off topic.

Have you tried to inherit the field name to transform him into a fields.function(_get_name_is_unique, fnct_inv=_save_name, type='char', store = True, string = 'Name'), The important part is the fnct_inv=_save_name wich allows you to write a name.

on 8/1/13, 6:36 AM

Don know how. Is it possible to use _sql_constraints?

on 8/1/13, 12:49 PM

Maybe, i don't use often _sql_constraints. If you want to use this, try that : http:// help.openerp.com/question/22620/how-can-i-mark-a-field-unique-in-a-custom-model/

on 8/1/13, 2:00 PM
On 9/29/13, 6:50 AM

Finally a solution i made:


About This Community

This platform 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.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 8/1/13, 3:21 AM
Seen: 2603 times
Last updated: 12/29/16, 8:39 AM