From 1b1fe38bb42382a95919b1fb89f0cf61377b8b5b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com>
Date: Wed, 22 Mar 2006 10:04:50 +0000
Subject: [PATCH] make sure account is defined

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@6169 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../scripts/validateTransactionLines.xml                  | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/bt5/erp5_accounting/WorkflowTemplateItem/portal_workflow/accounting_workflow/scripts/validateTransactionLines.xml b/bt5/erp5_accounting/WorkflowTemplateItem/portal_workflow/accounting_workflow/scripts/validateTransactionLines.xml
index f99b864c59..869b567509 100755
--- a/bt5/erp5_accounting/WorkflowTemplateItem/portal_workflow/accounting_workflow/scripts/validateTransactionLines.xml
+++ b/bt5/erp5_accounting/WorkflowTemplateItem/portal_workflow/accounting_workflow/scripts/validateTransactionLines.xml
@@ -107,6 +107,12 @@ if transaction.getPortalType() not in (\'Balance Transaction\',) :\n
       \n
     source_sum += source_quantity\n
     destination_sum += destination_quantity\n
+\n
+    if transaction_line.getSource(portal_type = \'Account\') is None and\\\n
+       transaction_line.getDestination(portal_type = \'Account\') is None and\\\n
+       transaction_line.getQuantity() != 0 :\n
+      raise ValidationFailed, N_(\'No Account defined for Line ${line_id}\',\n
+                        mapping = {\'line_id\': transaction_line.getId()} )\n
 \n
     for side in (SOURCE, DESTINATION) :\n
       if side == SOURCE :\n
@@ -249,11 +255,11 @@ transaction.AccountingTransaction_deleteEmptyLines(redirect=0)\n
                             <string>transaction_line</string>
                             <string>source_quantity</string>
                             <string>destination_quantity</string>
+                            <string>None</string>
                             <string>side</string>
                             <string>account</string>
                             <string>mirror_section</string>
                             <string>payment</string>
-                            <string>None</string>
                             <string>unicode</string>
                             <string>hasattr</string>
                             <string>int</string>
-- 
2.30.9