From 67b83597b42e2b845b134db071e2c08796ce5af1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com>
Date: Tue, 13 Feb 2007 10:25:15 +0000
Subject: [PATCH] check consistency using constraints when validating an
 account

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@12643 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../account_workflow/scripts/Account_Validate.xml     | 11 ++++++++---
 bt5/erp5_accounting/bt/revision                       |  2 +-
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/bt5/erp5_accounting/WorkflowTemplateItem/portal_workflow/account_workflow/scripts/Account_Validate.xml b/bt5/erp5_accounting/WorkflowTemplateItem/portal_workflow/account_workflow/scripts/Account_Validate.xml
index 011ac61f61..67c0b20b77 100644
--- a/bt5/erp5_accounting/WorkflowTemplateItem/portal_workflow/account_workflow/scripts/Account_Validate.xml
+++ b/bt5/erp5_accounting/WorkflowTemplateItem/portal_workflow/account_workflow/scripts/Account_Validate.xml
@@ -72,10 +72,13 @@
 from Products.ERP5Type.Message import Message\n
 \n
 account = sci[\'object\']\n
-N_ = lambda msgid: Message(\'erp5_uid\', msgid)\n
+N_ = lambda msgid: Message(\'erp5_ui\', msgid)\n
 \n
-if account.getGap() in (None, \'\') : \n
+if not account.getGap():\n
   raise ValidationFailed(N_("GAP is unset."))\n
+\n
+for err in account.checkConsistency():\n
+  raise ValidationFailed(N(err[4]))\n
 </string> </value>
         </item>
         <item>
@@ -127,7 +130,9 @@ if account.getGap() in (None, \'\') : \n
                             <string>account</string>
                             <string>N_</string>
                             <string>_getattr_</string>
-                            <string>None</string>
+                            <string>_getiter_</string>
+                            <string>err</string>
+                            <string>N</string>
                           </tuple>
                         </value>
                     </item>
diff --git a/bt5/erp5_accounting/bt/revision b/bt5/erp5_accounting/bt/revision
index 6fc1e6e18c..a5b5e0f805 100644
--- a/bt5/erp5_accounting/bt/revision
+++ b/bt5/erp5_accounting/bt/revision
@@ -1 +1 @@
-178
\ No newline at end of file
+181
\ No newline at end of file
-- 
2.30.9