changeset 1523:b9c64f64e267 stable

health : Fix bug #43090 Specialties should be unique per health professionals
author Luis Falcon <falcon@gnu.org>
date Wed, 27 Aug 2014 20:25:54 +0100
parents 42d65ad19c3f
children 88dd35d6efde
files tryton/health/health.py
diffstat 1 files changed, 8 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/tryton/health/health.py
+++ b/tryton/health/health.py
@@ -1229,6 +1229,14 @@
     def get_rec_name(self, name):
         return self.specialty.name
 
+    @classmethod
+    def __setup__(cls):
+        super(HealthProfessionalSpecialties, cls).__setup__()
+        cls._sql_constraints = [
+            ('name_sp_uniq', 'UNIQUE(name,specialty)',
+                'This specialty already exists for the health professional'),
+        ]
+
 
 class PhysicianSP(ModelSQL, ModelView):
     # Add Main Specialty field after from the Health Professional Speciality