From 5bc9eba7efe008f0ed928a471ff579886b5be199 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Mon, 22 Jun 2015 16:58:36 +0200 Subject: [PATCH] Use Constraint instance in ModelSQL._sql_constraints issue4814 review15491002 --- dunning.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dunning.py b/dunning.py index 2a5ec42e14..2603cb65b4 100644 --- a/dunning.py +++ b/dunning.py @@ -4,7 +4,7 @@ from collections import defaultdict from sql import Null -from trytond.model import Model, ModelView, ModelSQL, fields +from trytond.model import Model, ModelView, ModelSQL, fields, Unique from trytond.pyson import If, Eval from trytond.transaction import Transaction from trytond.wizard import Wizard, StateView, StateAction, StateTransition, \ @@ -111,8 +111,9 @@ class Dunning(ModelSQL, ModelView): @classmethod def __setup__(cls): super(Dunning, cls).__setup__() + table = cls.__table__() cls._sql_constraints = [ - ('line_unique', 'UNIQUE(line)', + ('line_unique', Unique(table, table.line), 'Line can be used only once on dunning.'), ]