Commit dbf660de authored by Kevin Deldycke's avatar Kevin Deldycke

Add a new fast input to create a bunch of paysheets.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@7733 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 990fb056
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<tuple>
<string>Products.PythonScripts.PythonScript</string>
<string>PythonScript</string>
</tuple>
<none/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Python_magic</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>__ac_local_roles__</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_body</string> </key>
<value> <string encoding="cdata"><![CDATA[
"""\n
Return a list of person which are employed full time (without any discontinuity)\n
by a given company during a period of time.\n
"""\n
company = context\n
subordinate_list = company.getSubordinationRelatedValueList()\n
\n
# If no period given, set the current year as the whole period\n
if start_date == None and stop_date == None:\n
from DateTime import DateTime\n
current_year = DateTime().year()\n
start_date = DateTime(current_year, 1, 1)\n
stop_date = DateTime(current_year + 1, 1, 1) - 1\n
\n
employees = []\n
\n
for person in subordinate_list:\n
if person.getPortalType() == \'Person\' and \\\n
person.getValidationState() == \'validated\' and \\\n
person.getRole() == \'internal\' and \\\n
person.getDefaultCareerGrade() != \'trainee\' and \\\n
person.getDefaultCareerStopDate() >= stop_date and \\\n
person.getDefaultCareerStartDate() <= start_date:\n
# TODO: take car of discontinued career step period\n
if person not in employees:\n
employees.append(person)\n
\n
return employees\n
]]></string> </value>
</item>
<item>
<key> <string>_code</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_filepath</string> </key>
<value> <string>Script (Python):/nexedi/portal_skins/erp5_payroll/Organisation_getEmployeeList</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>start_date=None, stop_date=None</string> </value>
</item>
<item>
<key> <string>errors</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>func_code</string> </key>
<value>
<object>
<klass>
<global name="FuncCode" module="Shared.DC.Scripts.Signature"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>co_argcount</string> </key>
<value> <int>2</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>start_date</string>
<string>stop_date</string>
<string>context</string>
<string>company</string>
<string>_getattr_</string>
<string>subordinate_list</string>
<string>None</string>
<string>DateTime</string>
<string>current_year</string>
<string>employees</string>
<string>_getiter_</string>
<string>person</string>
</tuple>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>func_defaults</string> </key>
<value>
<tuple>
<none/>
<none/>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Organisation_getEmployeeList</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<tuple>
<string>Products.PythonScripts.PythonScript</string>
<string>PythonScript</string>
</tuple>
<none/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Python_magic</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>__ac_local_roles__</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>from Products.ERP5Type.Document import newTempBase\n
from string import zfill\n
portal_object = context.getPortalObject()\n
\n
# Company must came from an updated fast input\n
company = context.restrictedTraverse(\'organisation_module/nexedi\')\n
\n
line_dict = {}\n
line_count = 0\n
for employee in company.Organisation_getEmployeeList():\n
line_count += 1\n
employee_path = \'/\'.join(employee.getPhysicalPath())\n
new_id = employee_path\n
l = newTempBase(portal_object, new_id)\n
l.setUid( \'new_%s\' % zfill(line_count, 4)) # XXX There is a security issue here\n
l.edit(uid=\'new_%s\' % zfill(line_count, 4)) # XXX There is a security issue here\n
employee_name = employee.getTitle()\n
l.edit( employee_name = employee_name\n
, employee_path = employee_path\n
# TODO: Pre-fill the gross salary with the nearest gross salary found in the given period for the\n
# same person, within the same organisation.\n
, gross_salary = None\n
)\n
# Use a tuple of (employee_name, new_id) to avoid conflict\n
line_dict[(employee_name, new_id)] = l\n
\n
listbox = []\n
# Sort employees by name\n
items = line_dict.items()\n
items.sort(lambda x, y: cmp(x[0][0], y[0][0]))\n
listbox = [item[1] for item in items]\n
\n
return listbox\n
</string> </value>
</item>
<item>
<key> <string>_code</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_filepath</string> </key>
<value> <string>Script (Python):/nexedi/portal_skins/erp5_payroll/PaySheetTransactionFastInput_getEmployeeList</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>**kw</string> </value>
</item>
<item>
<key> <string>errors</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>func_code</string> </key>
<value>
<object>
<klass>
<global name="FuncCode" module="Shared.DC.Scripts.Signature"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>co_argcount</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>kw</string>
<string>Products.ERP5Type.Document</string>
<string>newTempBase</string>
<string>string</string>
<string>zfill</string>
<string>_getattr_</string>
<string>context</string>
<string>portal_object</string>
<string>company</string>
<string>line_dict</string>
<string>line_count</string>
<string>_getiter_</string>
<string>employee</string>
<string>employee_path</string>
<string>new_id</string>
<string>l</string>
<string>employee_name</string>
<string>None</string>
<string>_write_</string>
<string>listbox</string>
<string>items</string>
<string>append</string>
<string>$append0</string>
<string>item</string>
<string>_getitem_</string>
</tuple>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>func_defaults</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>PaySheetTransactionFastInput_getEmployeeList</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<tuple>
<string>Products.PythonScripts.PythonScript</string>
<string>PythonScript</string>
</tuple>
<none/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Python_magic</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>__ac_local_roles__</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>from string import zfill\n
portal = context.getPortalObject()\n
N_ = portal.Base_translateString\n
acc_module = portal.accounting_module\n
\n
source_section = kw[\'source_section\']\n
start_date = kw[\'start_date\']\n
stop_date = kw[\'stop_date\']\n
payment_date = kw[\'payment_condition_payment_date\']\n
currency = kw[\'resource\']\n
\n
kw = {\'skip_redirect\': True}\n
for line_index in range(len(listbox)):\n
line = listbox[line_index]\n
\n
# Ignore employee without gross salary\n
gross_salary = line[\'gross_salary\']\n
if gross_salary in (\'\', None, 0.0):\n
continue\n
\n
# Get employee object\n
employee_path = line[\'employee_path\']\n
employee = context.restrictedTraverse(employee_path)\n
\n
# Create a new paysheet \n
paysheet = acc_module.newContent( portal_type = \'Pay Sheet Transaction\'\n
, destination_section = \'person_module/\' + employee.getId()\n
, source_section = source_section \n
, start_date = start_date \n
, stop_date = stop_date \n
, payment_condition_payment_date = payment_date \n
, resource = currency \n
, gross_salary = gross_salary\n
, immediate_reindex = 1\n
)\n
\n
# Get a pre-calculation of the paysheet\n
paysheet_lines = paysheet.PaySheetTransaction_initializePreview()\n
\n
# Reconstruct the listbox response\n
# TODO: Increase the atomicity of paysheets scripts to bypass this bad hack\n
paysheet_preview_listbox = []\n
listbox_key = 0\n
for preview_line in paysheet_lines:\n
listbox_key += 1\n
new_line = { \'listbox_key\' : zfill(listbox_key, 3)\n
, \'base\' : preview_line.getProperty(\'base\') \n
, \'employee_share_rate\': preview_line.getProperty(\'employee_share_rate\')\n
, \'employer_share_rate\': preview_line.getProperty(\'employer_share_rate\')\n
}\n
paysheet_preview_listbox.append(new_line)\n
\n
paysheet.PaySheetTransaction_postCalculation( listbox = paysheet_preview_listbox\n
, **kw\n
)\n
\n
context.REQUEST.RESPONSE.redirect("%s?portal_status_message=%s" % ( context.getPath()\n
, N_(\'Paysheets created as draft.\').replace(\' \', \'+\')\n
))\n
</string> </value>
</item>
<item>
<key> <string>_code</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_filepath</string> </key>
<value> <string>Script (Python):/nexedi/portal_skins/erp5_payroll/PaySheetTransaction_createPayroll</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>listbox=[], **kw</string> </value>
</item>
<item>
<key> <string>errors</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>func_code</string> </key>
<value>
<object>
<klass>
<global name="FuncCode" module="Shared.DC.Scripts.Signature"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>co_argcount</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>listbox</string>
<string>kw</string>
<string>string</string>
<string>zfill</string>
<string>_getattr_</string>
<string>context</string>
<string>portal</string>
<string>N_</string>
<string>acc_module</string>
<string>_getitem_</string>
<string>source_section</string>
<string>start_date</string>
<string>stop_date</string>
<string>payment_date</string>
<string>currency</string>
<string>True</string>
<string>_getiter_</string>
<string>range</string>
<string>len</string>
<string>line_index</string>
<string>line</string>
<string>gross_salary</string>
<string>None</string>
<string>employee_path</string>
<string>employee</string>
<string>paysheet</string>
<string>paysheet_lines</string>
<string>paysheet_preview_listbox</string>
<string>listbox_key</string>
<string>preview_line</string>
<string>new_line</string>
<string>_apply_</string>
</tuple>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>func_defaults</string> </key>
<value>
<tuple>
<list/>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>PaySheetTransaction_createPayroll</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<tuple>
<string>Products.ERP5Form.Form</string>
<string>ERP5Form</string>
</tuple>
<none/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>__ac_local_roles__</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_objects</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>action</string> </key>
<value> <string>PaySheetTransaction_createPayroll</string> </value>
</item>
<item>
<key> <string>encoding</string> </key>
<value> <string>UTF-8</string> </value>
</item>
<item>
<key> <string>enctype</string> </key>
<value> <string>multipart/form-data</string> </value>
</item>
<item>
<key> <string>group_list</string> </key>
<value>
<list>
<string>left</string>
<string>right</string>
<string>center</string>
<string>bottom</string>
<string>hidden</string>
</list>
</value>
</item>
<item>
<key> <string>groups</string> </key>
<value>
<dictionary>
<item>
<key> <string>bottom</string> </key>
<value>
<list>
<string>listbox</string>
</list>
</value>
</item>
<item>
<key> <string>center</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>hidden</string> </key>
<value>
<list>
<string>listbox_gross_salary</string>
<string>listbox_employee_path</string>
</list>
</value>
</item>
<item>
<key> <string>left</string> </key>
<value>
<list>
<string>my_source_section</string>
<string>my_resource</string>
</list>
</value>
</item>
<item>
<key> <string>right</string> </key>
<value>
<list>
<string>my_start_date</string>
<string>my_stop_date</string>
<string>my_payment_condition_payment_date</string>
</list>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>PaySheetTransaction_createPayrollFastInput</string> </value>
</item>
<item>
<key> <string>method</string> </key>
<value> <string>POST</string> </value>
</item>
<item>
<key> <string>name</string> </key>
<value> <string>PaySheetTransaction_createPayrollFastInput</string> </value>
</item>
<item>
<key> <string>pt</string> </key>
<value> <string>form_view_dialog</string> </value>
</item>
<item>
<key> <string>row_length</string> </key>
<value> <int>4</int> </value>
</item>
<item>
<key> <string>stored_encoding</string> </key>
<value> <string>UTF-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Create Payroll</string> </value>
</item>
<item>
<key> <string>unicode_mode</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>update_action</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<tuple>
<string>Products.Formulator.StandardFields</string>
<string>FloatField</string>
</tuple>
<none/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>listbox_gross_salary</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
<item>
<key> <string>not_float</string> </key>
<value> <string>You did not enter a floating point number.</string> </value>
</item>
<item>
<key> <string>required_not_found</string> </key>
<value> <string>Input is required but no input given.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>display_maxwidth</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>display_width</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>required</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>whitespace_preserve</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>display_maxwidth</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>display_width</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>required</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>whitespace_preserve</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>display_maxwidth</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>display_width</string> </key>
<value> <int>10</int> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>input_style</string> </key>
<value> <string>-1234.5</string> </value>
</item>
<item>
<key> <string>precision</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>required</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Gross Salary</string> </value>
</item>
<item>
<key> <string>whitespace_preserve</string> </key>
<value> <int>0</int> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
2006-06-15 Kevin
* Add a new fast input to create a bunch of paysheets.
2006-06-14 Kevin
* Payroll report system is now fully translatable.
* Update version number.
......
0.1.4
\ No newline at end of file
0.1.5
\ 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