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

Also handle the case where both sections are set, but none of them is member...

Also handle the case where both sections are set, but none of them is member of our preferred group. In such case we prefer the "default" view.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@34160 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 1d87a17f
......@@ -56,16 +56,27 @@
<value> <string>destination = context.getDestinationSectionValue()\n
section_category = context.portal_preferences\\\n
.getPreferredAccountingTransactionSectionCategory()\n
\n
# If the destination is an organisation member of the preferred section category,\n
# then we\'ll show destination view\n
if destination is not None and section_category:\n
if destination.getPortalType() == \'Person\':\n
return False\n
if destination.isMemberOf(section_category):\n
return True\n
\n
if destination is None and context.getSourceSection() is None:\n
return True\n
# If the source is an organisation member of the preferred section category,\n
# then we\'ll not show the destination view\n
source = context.getSourceSectionValue()\n
if source is not None and section_category:\n
if source.getPortalType() == \'Person\':\n
return True\n
if source.isMemberOf(section_category):\n
return False\n
\n
return False\n
# If we reach this point, none of the sections are member of the preferred section\n
# category, we\'ll then show destination view, the default for this script\n
return True\n
</string> </value>
</item>
<item>
......@@ -109,6 +120,7 @@ return False\n
<string>None</string>
<string>False</string>
<string>True</string>
<string>source</string>
</tuple>
</value>
</item>
......
......@@ -56,16 +56,27 @@
<value> <string>source = context.getSourceSectionValue()\n
section_category = context.portal_preferences\\\n
.getPreferredAccountingTransactionSectionCategory()\n
\n
# If the source is an organisation member of the preferred section category,\n
# then we\'ll show the source view\n
if source is not None and section_category:\n
if source.getPortalType() == \'Person\':\n
return False\n
if source.isMemberOf(section_category):\n
return True\n
\n
if source is None and context.getDestinationSection() is None:\n
return True\n
# Else, if the destination is an organisation member of the preferred section category,\n
# then we\'ll not show source view\n
destination = context.getDestinationSectionValue()\n
if destination is not None and section_category:\n
if source.getPortalType() == \'Person\':\n
return True\n
if source.isMemberOf(section_category):\n
return False\n
\n
return False\n
# If we reach this point, none of the sections are member of the preferred section\n
# category, we\'ll then show source view, default for this script\n
return True\n
</string> </value>
</item>
<item>
......@@ -109,6 +120,7 @@ return False\n
<string>None</string>
<string>False</string>
<string>True</string>
<string>destination</string>
</tuple>
</value>
</item>
......
1160
\ No newline at end of file
1163
\ 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