From c5482db3cf6f04914599de4ab92a3d7bd21680e2 Mon Sep 17 00:00:00 2001 From: Charbel Jacquin Date: Wed, 29 Jul 2015 11:32:12 +0200 Subject: [PATCH] add unique constraints on `name` and `name_inverse` --- partner_relations/model/res_partner_relation_type.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/partner_relations/model/res_partner_relation_type.py b/partner_relations/model/res_partner_relation_type.py index 624ac4988..3f341859d 100644 --- a/partner_relations/model/res_partner_relation_type.py +++ b/partner_relations/model/res_partner_relation_type.py @@ -62,6 +62,12 @@ class ResPartnerRelationType(models.Model): default=False, ) + _sql_constraints = [ + ('name_unique', 'unique(name)', 'partner relation name already exists!'), + ('name_inverse_unique', 'unique(name_inverse)', + 'partner relation name_inverse already exists!'), + ] + @api.model def _get_partner_types(self): return [