Odoo Help


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.


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

on 8/1/13, 3:21 AM 1,633 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:


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

0 follower(s)


Asked: 8/1/13, 3:21 AM
Seen: 1633 times
Last updated: 3/16/15, 8:10 AM