From fbafc0fb8e5193a843202186bda5fb24fe314fb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Mon, 22 Jun 2015 16:59:40 +0200 Subject: [PATCH] Use Constraint instance in ModelSQL._sql_constraints issue4814 review15491002 --- bom.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bom.py b/bom.py index 45e421a0dd..fa8a62a732 100644 --- a/bom.py +++ b/bom.py @@ -1,6 +1,6 @@ # This file is part of Tryton. The COPYRIGHT file at the top level of # this repository contains the full copyright notices and license terms. -from trytond.model import ModelView, ModelSQL, fields +from trytond.model import ModelView, ModelSQL, fields, Unique from trytond.wizard import Wizard, StateView, Button from trytond.transaction import Transaction from trytond.pyson import Eval @@ -76,8 +76,9 @@ class BOMInput(ModelSQL, ModelView): @classmethod def __setup__(cls): super(BOMInput, cls).__setup__() + t = cls.__table__() cls._sql_constraints = [ - ('product_bom_uniq', 'UNIQUE(product, bom)', + ('product_bom_uniq', Unique(t, t.product, t.bom), 'product_bom_uniq'), ] cls._error_messages.update({