Mercurial > hgweb > health
changeset 1531:d170e3afc0f9 stable
health: Unique constraint in insurance ID/number as per each insurance company
| author | Luis Falcon <falcon@gnu.org> |
|---|---|
| date | Tue, 09 Sep 2014 10:21:55 +0100 |
| parents | 2877b3116244 |
| children | 6cbf09708a36 |
| files | tryton/health/health.py |
| diffstat | 1 files changed, 8 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/tryton/health/health.py +++ b/tryton/health/health.py @@ -1654,7 +1654,7 @@ member_since = fields.Date('Member since') member_exp = fields.Date('Expiration date') category = fields.Char( - 'Category', help='Insurance company plan / category') + 'Category', help='Insurance company category') insurance_type = fields.Selection([ (None, ''), @@ -1672,6 +1672,13 @@ def get_rec_name(self, name): return (self.company.name + ' : ' + self.number) + @classmethod + def __setup__(cls): + super(Insurance, cls).__setup__() + cls._sql_constraints = [ + ('number_uniq', 'UNIQUE(number,company)', + 'The number must be unique per insurance company'), + ] class AlternativePersonID (ModelSQL, ModelView): 'Alternative person ID'
