From 1fbd6fd4dce14b4dc9757e805ddcff182920f594 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com>
Date: Fri, 16 Oct 2009 10:17:46 +0000
Subject: [PATCH] bug fix, we should check for accounting periods inside the
 mapping related organisation

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

diff --git a/bt5/erp5_accounting/WorkflowTemplateItem/portal_workflow/accounting_workflow/scripts/validateTransaction.xml b/bt5/erp5_accounting/WorkflowTemplateItem/portal_workflow/accounting_workflow/scripts/validateTransaction.xml
index 3d59bfdf57..f23a002d24 100644
--- a/bt5/erp5_accounting/WorkflowTemplateItem/portal_workflow/accounting_workflow/scripts/validateTransaction.xml
+++ b/bt5/erp5_accounting/WorkflowTemplateItem/portal_workflow/accounting_workflow/scripts/validateTransaction.xml
@@ -124,8 +124,10 @@ if not skip_period_validation :\n
     if no_accounts:\n
       valid_date = True\n
     else:\n
-      section = transaction.getSourceSectionValue()\n
-      if section is not None and not len(section.contentValues(\n
+      section = source_section\n
+      if section.getPortalType() == \'Organisation\':\n
+        section = section.Organisation_getMappingRelatedOrganisation()\n
+      if not len(section.contentValues(\n
              filter=dict(portal_type="Accounting Period"))):\n
         valid_date = True\n
       else:\n
@@ -152,8 +154,10 @@ if not skip_period_validation :\n
     if no_accounts:\n
       valid_date = True\n
     else:\n
-      section = transaction.getDestinationSectionValue()\n
-      if section is not None and not len(section.contentValues(\n
+      section = destination_section\n
+      if section.getPortalType() == \'Organisation\':\n
+        section = section.Organisation_getMappingRelatedOrganisation()\n
+      if not len(section.contentValues(\n
              filter=dict(portal_type="Accounting Period"))):\n
         valid_date = True\n
       else:\n
diff --git a/bt5/erp5_accounting/bt/revision b/bt5/erp5_accounting/bt/revision
index cf5106d72a..e37d32abba 100644
--- a/bt5/erp5_accounting/bt/revision
+++ b/bt5/erp5_accounting/bt/revision
@@ -1 +1 @@
-999
\ No newline at end of file
+1000
\ No newline at end of file
-- 
2.30.9