diff --git a/statement.py b/statement.py index 9fc0e49dc4..ec1a3422cb 100644 --- a/statement.py +++ b/statement.py @@ -7,7 +7,7 @@ from itertools import groupby from sql import Null from sql.aggregate import Max, Sum -from trytond.model import Workflow, ModelView, ModelSQL, fields +from trytond.model import Workflow, ModelView, ModelSQL, fields, Check from trytond.pyson import Eval, If, Bool from trytond.transaction import Transaction from trytond import backend @@ -558,8 +558,9 @@ class Line(ModelSQL, ModelView): 'amount_greater_invoice_amount_to_pay': ('Amount "%s" is ' 'greater than the amount to pay of invoice.'), }) + t = cls.__table__() cls._sql_constraints += [ - ('check_statement_line_amount', 'CHECK(amount != 0)', + ('check_statement_line_amount', Check(t, t.amount != 0), 'Amount should be a positive or negative value.'), ]