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

Take into account the group from open Assignments in Person_getPrimaryGroup

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@21062 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 92b71180
...@@ -65,7 +65,9 @@ ...@@ -65,7 +65,9 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>"""\n <value> <string encoding="cdata"><![CDATA[
"""\n
Returns a group category based on career\n Returns a group category based on career\n
and or assignments in such way that the returned\n and or assignments in such way that the returned\n
value describes the most accurately the default group\n value describes the most accurately the default group\n
...@@ -79,11 +81,24 @@ ...@@ -79,11 +81,24 @@
(to be implemented).\n (to be implemented).\n
"""\n """\n
\n \n
try:\n from DateTime import DateTime\n
return context.default_career.getGroup()\n now = DateTime()\n
except AttributeError:\n \n
return None\n for assignment in context.contentValues(portal_type=\'Assignment\',\n
</string> </value> checked_permission=\'Access contents information\'):\n
\n
if assignment.getGroup() \\\n
and assignment.getValidationState() == \'open\' \\\n
and ( assignment.getStartDate() is None or\n
assignment.getStartDate() <= now <= assignment.getStopDate()):\n
return assignment.getGroup()\n
\n
# no group found on open assignments, returns the default group\n
# (on a person document this is acquired on the default career\'s subordination)\n
return context.getGroup()\n
]]></string> </value>
</item> </item>
<item> <item>
<key> <string>_code</string> </key> <key> <string>_code</string> </key>
...@@ -131,9 +146,12 @@ except AttributeError:\n ...@@ -131,9 +146,12 @@ except AttributeError:\n
<key> <string>co_varnames</string> </key> <key> <string>co_varnames</string> </key>
<value> <value>
<tuple> <tuple>
<string>DateTime</string>
<string>now</string>
<string>_getiter_</string>
<string>_getattr_</string> <string>_getattr_</string>
<string>context</string> <string>context</string>
<string>AttributeError</string> <string>assignment</string>
<string>None</string> <string>None</string>
</tuple> </tuple>
</value> </value>
......
299 300
\ 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