Commit e9288342 authored by Jérome Perrin's avatar Jérome Perrin

use the same code to get section uids as in the script to create balance

transaction (temp implementation)


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@42342 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent ea08f50f
...@@ -72,7 +72,37 @@ section_category = section.getGroup(base=True)\n ...@@ -72,7 +72,37 @@ section_category = section.getGroup(base=True)\n
if not section_category:\n if not section_category:\n
raise ValidationFailed, translateString("This Organisation must be member of a Group")\n raise ValidationFailed, translateString("This Organisation must be member of a Group")\n
\n \n
section_uid = portal.Base_getSectionUidListForSectionCategory(section_category)\n \n
# XXX copy and paste from AccountingPeriod_createBalanceTransaction !\n
def isIndenpendantSection(section):\n
for ap in section.contentValues(\n
portal_type=\'Accounting Period\',\n
checked_permission=\'View\'):\n
if ap.getSimulationState() in (\'started\', \'stopped\', \'delivered\'):\n
return True\n
return False\n
\n
def getDependantSectionList(group, main_section):\n
section_list = []\n
recurse = True\n
for section in group.getGroupRelatedValueList(\n
portal_type=\'Organisation\',\n
strict_membership=True,\n
checked_permission=\'View\'):\n
if section != main_section:\n
if isIndenpendantSection(section):\n
recurse = False\n
else:\n
section_list.append(section)\n
if recurse:\n
for subgroup in group.contentValues():\n
section_list.extend(getDependantSectionList(subgroup, main_section))\n
\n
return section_list\n
# /XXX\n
\n
section_uid = [section.getUid()] + [x.getUid() for x in getDependantSectionList(section.getGroupValue(), section)]\n
\n
\n \n
movement_list = portal.portal_simulation.getMovementHistoryList(\n movement_list = portal.portal_simulation.getMovementHistoryList(\n
section_uid=section_uid,\n section_uid=section_uid,\n
......
1431 1432
\ No newline at end of file \ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment