fixup! [MIG] document_page_tags

This commit is contained in:
Holger Brunn 2018-07-18 16:04:48 +02:00 committed by Marcel Savegnago
parent 2767b218bf
commit d50086cb77
2 changed files with 3 additions and 19 deletions

View File

@ -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)

View File

@ -1,20 +1,4 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# This module copyright (C) 2015 Therp BV <http://therp.nl>.
#
# 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 <http://www.gnu.org/licenses/>.
#
##############################################################################
# Copyright 2015-2018 Therp BV <https://therp.nl>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from . import test_document_page_tags