From 93cef8c954dbc199fa49b3e4cf964f348e2f138a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Tue, 5 Aug 2008 11:35:35 +0200 Subject: [PATCH] Add translation of _constraints --- account.py | 14 +++++++++----- line.py | 7 +++++-- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/account.py b/account.py index 3f54fb0b3e..cfa695d512 100644 --- a/account.py +++ b/account.py @@ -62,9 +62,11 @@ class Account(OSV): def __init__(self): super(Account, self).__init__() self._constraints += [ - ('check_recursion', - 'Error! You can not create recursive account.', ['parent']), + ('check_recursion', 'recursive_accounts'), ] + self._error_messages.update({ + 'recursive_accounts': 'You can not create recursive accounts!', + }) self._order.insert(0, ('code', 'ASC')) def default_active(self, cursor, user, context=None): @@ -367,10 +369,12 @@ class AccountSelection(OSV): def __init__(self): super(AccountSelection, self).__init__() self._constraints += [ - ('check_root', 'Can not have many accounts with the same root ' \ - 'or a missing mandatory root account!', - ['accounts']), + ('check_root', 'root_account'), ] + self._error_messages.update({ + 'root_account': 'Can not have many accounts with the same root ' \ + 'or a missing mandatory root account!', + }) def check_root(self, cursor, user, ids): "Check Root" diff --git a/line.py b/line.py index 3f7566ab57..a34cc17c83 100644 --- a/line.py +++ b/line.py @@ -34,9 +34,12 @@ class Line(OSV): 'Wrong credit/debit values!'), ] self._constraints += [ - ('check_account', 'You can not create move line \n' \ - 'on view/inactive account!', ['account']), + ('check_account', 'line_on_view_inactive_account'), ] + self._error_messages.update({ + 'line_on_view_inactive_account': 'You can not create move line\n' \ + 'on view/inactive account!', + }) self._order.insert(0, ('date', 'ASC')) def default_currency(self, cursor, user, context=None):