This question has been flagged
1 Reply
7564 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.

Avatar
Discard

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.

Author

Don know how. Is it possible to use _sql_constraints?

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/

Author Best Answer

Finally a solution i made:

https://github.com/youring/company_unique

Avatar
Discard