Fix sql constraints

This commit is contained in:
Jes?s Mart?n Jim?nez 2016-07-06 11:49:56 +02:00
parent a284af91e7
commit 88622bc98c

View file

@ -1,7 +1,7 @@
# This file is part of the account_invoice_multisequence module for 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.pool import Pool, PoolMeta
from trytond.pyson import Eval, If, In, Not
from trytond.transaction import Transaction
@ -57,8 +57,9 @@ class AccountJournalInvoiceSequence(ModelSQL, ModelView):
@classmethod
def __setup__(cls):
super(AccountJournalInvoiceSequence, cls).__setup__()
t = cls.__table__()
cls._sql_constraints += [
('journal_fiscalyear_uniq', 'UNIQUE(journal, fiscalyear)',
('journal_fiscalyear_uniq', Unique(t, t.journal, t.fiscalyear),
'Fiscal Year - Journal pair must be unique.'),
]