From 1d94a79b7a675ef6fa4bae29c6b13e0a9a7dccd5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com>
Date: Fri, 26 Mar 2010 14:21:43 +0000
Subject: [PATCH] first get accounting period from strict membership

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

diff --git a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Base_getAccountingPeriodStartDateForSectionCategory.xml b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Base_getAccountingPeriodStartDateForSectionCategory.xml
index a56817a25e..89c5bd0c10 100644
--- a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Base_getAccountingPeriodStartDateForSectionCategory.xml
+++ b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Base_getAccountingPeriodStartDateForSectionCategory.xml
@@ -59,10 +59,13 @@ from Products.ERP5Type.Cache import CachingMethod\n
 \n
 def getAccountingPeriodStartDateForSectionCategory(section_category, date):\n
   portal = context.getPortalObject()\n
-  section_uid = portal.Base_getSectionUidListForSectionCategory(\n
-                                      section_category)\n
   # XXX for now we guess period start date from the first organisation having\n
-  # accounting periods\n
+  # accounting periods, giving priority to the organisation directly associated\n
+  # to the section category\n
+  section_uid = portal.Base_getSectionUidListForSectionCategory(\n
+                                      section_category, strict_membership=True)\n
+  section_uid.extend(portal.Base_getSectionUidListForSectionCategory(\n
+                                      section_category, strict_membership=False))\n
   period_start_date = None\n
   valid_accounting_period = dict(portal_type=\'Accounting Period\',\n
                                  simulation_state=(\'planned\', \'confirmed\',\n
diff --git a/bt5/erp5_accounting/bt/revision b/bt5/erp5_accounting/bt/revision
index 5ec4258d79..a899ac6c51 100644
--- a/bt5/erp5_accounting/bt/revision
+++ b/bt5/erp5_accounting/bt/revision
@@ -1 +1 @@
-1159
\ No newline at end of file
+1160
\ No newline at end of file
-- 
2.30.9