Commit b3dc7067 authored by Kevin Deldycke's avatar Kevin Deldycke

Translate the paysheet title when its created automaticcaly.

Translate portal status message.
Add comments.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@7735 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 79ae6a89
...@@ -68,7 +68,10 @@ ...@@ -68,7 +68,10 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string># Get Precision\n <value> <string>portal = context.getPortalObject()\n
N_ = portal.Base_translateString\n
\n
# Get Precision\n
precision = context.Base_getPreferredPrecision()\n precision = context.Base_getPreferredPrecision()\n
r_ = lambda x: context.Base_getRoundValue(x, precision)\n r_ = lambda x: context.Base_getRoundValue(x, precision)\n
\n \n
...@@ -121,24 +124,32 @@ def createPaySheetItem(title=\'\', res=\'\', dest_org=\'\', cells=[]):\n ...@@ -121,24 +124,32 @@ def createPaySheetItem(title=\'\', res=\'\', dest_org=\'\', cells=[]):\n
, category_list = cell_cat_list\n , category_list = cell_cat_list\n
)\n )\n
\n \n
# set the title of the paysheet if empty\n # Set the title of the paysheet if empty\n
# TODO: translate using current language\n months = [ \'January\', \'February\', \'March\', \'April\', \'May\', \'June\', \'July\'\n
months = (\'janvier\', \'f\xc3\xa9vrier\', \'mars\', \'avril\', \'mai\', \'juin\', \'juillet\', \'ao\xc3\xbbt\', \'septembre\', \'octobre\', \'novembre\', \'d\xc3\xa9cembre\')\n , \'August\', \'September\', \'October\', \'November\', \'December\'\n
]\n
if context.getTitle() in (\'\', None):\n if context.getTitle() in (\'\', None):\n
if context.getStartDate() in (\'\', None):\n new_title = \'%s %s\' % ( N_(\'Salary\')\n
context.setTitle(\'Salaire %s\' % context.getDestinationSectionValue().getTitle())\n , context.getDestinationSectionValue().getTitle()\n
else:\n )\n
context.setTitle(\'Salaire %s %s %s\' % (context.getDestinationSectionValue().getTitle(), months[int(str(context.getStartDate())[5:7])-1], str(context.getStartDate())[0:4]))\n if context.getStartDate() not in (\'\', None):\n
payroll_date = context.getStartDate()\n
new_title += \' %s %s\' % ( N_(months[payroll_date.month()])\n
, payroll_date.year()\n
)\n
context.setTitle(new_title)\n
\n \n
# get the ordered list of standard preview line objects\n # Get the ordered list of standard preview line objects\n
std_lines = context.PaySheetTransaction_initializePreview()\n std_lines = context.PaySheetTransaction_initializePreview()\n
# this list contain all paysheet items, indexed by service\n \n
# This list contain all paysheet items, indexed by service\n
paysheet_items = {}\n paysheet_items = {}\n
# initialise the user preview line index\n \n
# Initialise the user preview line index\n
user_line_index = 0\n user_line_index = 0\n
total_employee_share = 0.0\n total_employee_share = 0.0\n
\n \n
# scan every standard preview line to create an item for each service\n # Scan every standard preview line to create an item for each service\n
for std_line in std_lines:\n for std_line in std_lines:\n
# get the service url (unique because containing the id)\n # get the service url (unique because containing the id)\n
service = std_line.getProperty(\'service_url\')\n service = std_line.getProperty(\'service_url\')\n
...@@ -225,7 +236,8 @@ createPaySheetItem( title = \'Salary\'\n ...@@ -225,7 +236,8 @@ createPaySheetItem( title = \'Salary\'\n
)\n )\n
\n \n
# Return to pay sheet\n # Return to pay sheet\n
return context.REQUEST.RESPONSE.redirect(context.absolute_url() + \'?portal_status_message=Pay+sheet+calculation+done.\')\n if not(kw.has_key(\'skip_redirect\') and kw[\'skip_redirect\'] == True):\n
return context.REQUEST.RESPONSE.redirect(context.absolute_url() + \'?portal_status_message=Pay+sheet+calculation+done.\')\n
</string> </value> </string> </value>
</item> </item>
<item> <item>
...@@ -238,12 +250,6 @@ return context.REQUEST.RESPONSE.redirect(context.absolute_url() + \'?portal_stat ...@@ -238,12 +250,6 @@ return context.REQUEST.RESPONSE.redirect(context.absolute_url() + \'?portal_stat
<key> <string>_filepath</string> </key> <key> <string>_filepath</string> </key>
<value> <string>Script (Python):/nexedi/portal_skins/erp5_payroll/PaySheetTransaction_postCalculation</string> </value> <value> <string>Script (Python):/nexedi/portal_skins/erp5_payroll/PaySheetTransaction_postCalculation</string> </value>
</item> </item>
<item>
<key> <string>_owner</string> </key>
<value>
<none/>
</value>
</item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>listbox=[], **kw</string> </value> <value> <string>listbox=[], **kw</string> </value>
...@@ -276,6 +282,8 @@ return context.REQUEST.RESPONSE.redirect(context.absolute_url() + \'?portal_stat ...@@ -276,6 +282,8 @@ return context.REQUEST.RESPONSE.redirect(context.absolute_url() + \'?portal_stat
<string>kw</string> <string>kw</string>
<string>_getattr_</string> <string>_getattr_</string>
<string>context</string> <string>context</string>
<string>portal</string>
<string>N_</string>
<string>precision</string> <string>precision</string>
<string>r_</string> <string>r_</string>
<string>id_list</string> <string>id_list</string>
...@@ -284,9 +292,9 @@ return context.REQUEST.RESPONSE.redirect(context.absolute_url() + \'?portal_stat ...@@ -284,9 +292,9 @@ return context.REQUEST.RESPONSE.redirect(context.absolute_url() + \'?portal_stat
<string>createPaySheetItem</string> <string>createPaySheetItem</string>
<string>months</string> <string>months</string>
<string>None</string> <string>None</string>
<string>new_title</string>
<string>payroll_date</string>
<string>_getitem_</string> <string>_getitem_</string>
<string>int</string>
<string>str</string>
<string>std_lines</string> <string>std_lines</string>
<string>paysheet_items</string> <string>paysheet_items</string>
<string>user_line_index</string> <string>user_line_index</string>
...@@ -297,17 +305,20 @@ return context.REQUEST.RESPONSE.redirect(context.absolute_url() + \'?portal_stat ...@@ -297,17 +305,20 @@ return context.REQUEST.RESPONSE.redirect(context.absolute_url() + \'?portal_stat
<string>tax_cat</string> <string>tax_cat</string>
<string>_write_</string> <string>_write_</string>
<string>user_line</string> <string>user_line</string>
<string>int</string>
<string>base</string> <string>base</string>
<string>cat</string> <string>cat</string>
<string>new_cell</string> <string>new_cell</string>
<string>employer_rate</string> <string>employer_rate</string>
<string>employee_rate</string> <string>employee_rate</string>
<string>str</string>
<string>float</string> <string>float</string>
<string>rate</string> <string>rate</string>
<string>item</string> <string>item</string>
<string>hasattr</string> <string>hasattr</string>
<string>service_module_name</string> <string>service_module_name</string>
<string>gross_salary</string> <string>gross_salary</string>
<string>True</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
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