Constrain and Unique field
_sql_constraints = [('issue_date_project_uniq', 'unique (issue_date, project)',
"Combination of project and date already exists !")]
@api.constrains('issue_date', 'project')
def _check_project_unique(self):
record_count = self.search_count([('issue_date', '=', self.issue_date),
('project', '=', self.project.id),
('id', '!=', self.id)])
if record_count > 0:
raise ValidationError("Record already exists!")
Views | |
---|---|
1 | Total Views |
1 | Members Views |
0 | Public Views |
Actions | |
---|---|
0 | Likes |
0 | Dislikes |
0 | Comments |
Share by mail
Please login to share this webpage by email.