diff --git a/document_page_tags/models/document_page_tag.py b/document_page_tags/models/document_page_tag.py index 1229ff9a..f0380375 100644 --- a/document_page_tags/models/document_page_tag.py +++ b/document_page_tags/models/document_page_tag.py @@ -17,7 +17,7 @@ class DocumentPageTag(models.Model): @api.model def create(self, vals): """Be nice when trying to create duplicates""" - existing = self.search([('name', '=ilike', vals['name'])]) + existing = self.search([('name', '=ilike', vals['name'])], limit=1) if existing: return existing return super(DocumentPageTag, self).create(vals) diff --git a/document_page_tags/tests/__init__.py b/document_page_tags/tests/__init__.py index 0816344d..5a9ce340 100644 --- a/document_page_tags/tests/__init__.py +++ b/document_page_tags/tests/__init__.py @@ -1,20 +1,4 @@ # -*- coding: utf-8 -*- -############################################################################## -# -# This module copyright (C) 2015 Therp BV . -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -# -############################################################################## +# Copyright 2015-2018 Therp BV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). from . import test_document_page_tags