Commit f1d6fd4a authored by Kevin Deldycke's avatar Kevin Deldycke

Allow people who started to work within the current year to appear in the...

Allow people who started to work within the current year to appear in the employee list returned by Organisation_getEmployeeList.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@9616 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 60e63e61
...@@ -77,38 +77,56 @@ ...@@ -77,38 +77,56 @@
company = context\n company = context\n
subordinate_list = company.getSubordinationRelatedValueList()\n subordinate_list = company.getSubordinationRelatedValueList()\n
\n \n
# If no period given, set the current year as the whole period\n period_given = True\n
\n
\n
# If no period given, just check that the employee is still working tommorow\n
if start_date == None and stop_date == None:\n if start_date == None and stop_date == None:\n
period_given = False\n
from DateTime import DateTime\n from DateTime import DateTime\n
current_year = DateTime().year()\n tomorrow = DateTime() + 1\n
start_date = DateTime(current_year, 1, 1)\n \n
stop_date = DateTime(current_year + 1, 1, 1) - 1\n
\n \n
# Get persons\n # Get persons\n
person_list = []\n person_list = []\n
for subordinate in subordinate_list:\n for subordinate in subordinate_list:\n
sub_obj = subordinate \n sub_obj = subordinate \n
sub_type = subordinate.getPortalType()\n sub_type = subordinate.getPortalType()\n
\n
# The parent of Assignments and Careers objects are Persons\n # The parent of Assignments and Careers objects are Persons\n
if sub_type in (\'Assignment\', \'Career\'):\n if sub_type in (\'Assignment\', \'Career\'):\n
sub_obj = subordinate.getParent()\n sub_obj = subordinate.getParent()\n
sub_type = sub_obj.getPortalType()\n sub_type = sub_obj.getPortalType()\n
\n
# Last check to be sure we only include persons in person_list\n # Last check to be sure we only include persons in person_list\n
if sub_type == \'Person\':\n if sub_type == \'Person\':\n
person_list.append(sub_obj)\n person_list.append(sub_obj)\n
\n \n
\n
# Filter person list to only get employees\n # Filter person list to only get employees\n
employees = []\n employees = []\n
for person in person_list:\n for person in person_list:\n
\n
if person.getValidationState() == \'validated\' and \\\n if person.getValidationState() == \'validated\' and \\\n
person.getDefaultCareerStopDate() >= stop_date and \\\n person.getRole() not in (None, \'\') and \\\n
person.getDefaultCareerStartDate() <= start_date and \\\n
person.getRole().endswith(\'internal\') and \\\n person.getRole().endswith(\'internal\') and \\\n
person.getDefaultCareerGrade() not in (None, \'\') and \\\n person.getDefaultCareerGrade() not in (None, \'\') and \\\n
not person.getDefaultCareerGrade().endswith(\'trainee\'):\n not person.getDefaultCareerGrade().endswith(\'trainee\'):\n
\n
# If period given, check that the employee was working full\n
# time (without any discontinuity) within the period.\n
# If no period given, just check that the employee is still\n
# working tommorow.\n
# TODO: take car of discontinued career step period\n # TODO: take car of discontinued career step period\n
if person not in employees:\n if (period_given and \\\n
employees.append(person)\n person.getDefaultCareerStopDate() >= stop_date and \\\n
person.getDefaultCareerStartDate() <= start_date) or \\\n
(not period_given and \\\n
person.getDefaultCareerStopDate() >= tomorrow):\n
\n
if person not in employees:\n
employees.append(person)\n
\n
\n \n
return employees\n return employees\n
...@@ -161,9 +179,12 @@ return employees\n ...@@ -161,9 +179,12 @@ return employees\n
<string>company</string> <string>company</string>
<string>_getattr_</string> <string>_getattr_</string>
<string>subordinate_list</string> <string>subordinate_list</string>
<string>True</string>
<string>period_given</string>
<string>None</string> <string>None</string>
<string>False</string>
<string>DateTime</string> <string>DateTime</string>
<string>current_year</string> <string>tomorrow</string>
<string>person_list</string> <string>person_list</string>
<string>_getiter_</string> <string>_getiter_</string>
<string>subordinate</string> <string>subordinate</string>
......
2006-09-01 Kevin
* Allow people who started to work within the current year to appear in the employee list returned by Organisation_getEmployeeList.
2006-08-23 Kevin 2006-08-23 Kevin
* Fix bad comparison on pre_calculation. * Fix bad comparison on pre_calculation.
......
20 25
\ No newline at end of file \ No newline at end of file
0.1.8 0.1.9
\ 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