From 60f519c29efb9ebd2a9b3e1db4c835735bfa3c60 Mon Sep 17 00:00:00 2001 From: Nikos Tsirintanis Date: Thu, 6 Jun 2019 17:00:01 +0200 Subject: [PATCH] Added parent_id to SQL constraints --- date_range/models/date_range.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/date_range/models/date_range.py b/date_range/models/date_range.py index 3be3046..b6b17ad 100644 --- a/date_range/models/date_range.py +++ b/date_range/models/date_range.py @@ -38,8 +38,8 @@ class DateRange(models.Model): comodel_name='date.range', string="Parent", index=1) _sql_constraints = [ - ('date_range_uniq', 'unique (name,type_id, company_id)', - 'A date range must be unique per company !')] + ('date_range_uniq', 'unique (name,type_id, company_id, parent_id)', + 'A date range must be unique per company and parent!')] @api.onchange('company_id', 'type_id') def _onchange_company_id(self):