Commit 6deec1cb authored by Kevin Deldycke's avatar Kevin Deldycke

Fix some UI and fields name.

Calculate taxable grand total on printing.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@10957 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent c3f4f188
No related merge requests found
...@@ -58,7 +58,7 @@ ...@@ -58,7 +58,7 @@
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>Pay Sheet Cells</string> </value> <value> <string>Cells</string> </value>
</item> </item>
<item> <item>
<key> <string>visible</string> </key> <key> <string>visible</string> </key>
......
...@@ -58,7 +58,7 @@ ...@@ -58,7 +58,7 @@
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>Pay Sheet Line View</string> </value> <value> <string>View</string> </value>
</item> </item>
<item> <item>
<key> <string>visible</string> </key> <key> <string>visible</string> </key>
......
...@@ -112,7 +112,7 @@ ...@@ -112,7 +112,7 @@
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string></string> </value> <value> <string>Pay Sheet Line</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -215,7 +215,7 @@ ...@@ -215,7 +215,7 @@
</item> </item>
<item> <item>
<key> <string>editable</string> </key> <key> <string>editable</string> </key>
<value> <int>1</int> </value> <value> <int>0</int> </value>
</item> </item>
<item> <item>
<key> <string>editable_expression</string> </key> <key> <string>editable_expression</string> </key>
......
...@@ -245,6 +245,14 @@ ...@@ -245,6 +245,14 @@
<key> <string>values</string> </key> <key> <string>values</string> </key>
<value> <value>
<dictionary> <dictionary>
<item>
<key> <string>allow_creation</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>allow_jump</string> </key>
<value> <int>1</int> </value>
</item>
<item> <item>
<key> <string>alternate_name</string> </key> <key> <string>alternate_name</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
...@@ -255,7 +263,17 @@ ...@@ -255,7 +263,17 @@
</item> </item>
<item> <item>
<key> <string>catalog_index</string> </key> <key> <string>catalog_index</string> </key>
<value> <string>relative_url</string> </value> <value> <string>title</string> </value>
</item>
<item>
<key> <string>columns</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>container_getter_id</string> </key>
<value> <string></string> </value>
</item> </item>
<item> <item>
<key> <string>css_class</string> </key> <key> <string>css_class</string> </key>
...@@ -313,29 +331,61 @@ ...@@ -313,29 +331,61 @@
<key> <string>extra</string> </key> <key> <string>extra</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
</item> </item>
<item>
<key> <string>extra_item</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>first_item</string> </key>
<value> <int>0</int> </value>
</item>
<item> <item>
<key> <string>hidden</string> </key> <key> <string>hidden</string> </key>
<value> <int>0</int> </value> <value> <int>0</int> </value>
</item> </item>
<item>
<key> <string>items</string> </key>
<value>
<list/>
</value>
</item>
<item> <item>
<key> <string>jump_method</string> </key> <key> <string>jump_method</string> </key>
<value> <string>Base_jumpToRelatedDocument</string> </value> <value> <string>Base_jumpToRelatedDocument</string> </value>
</item> </item>
<item>
<key> <string>list_method</string> </key>
<value> <string></string> </value>
</item>
<item> <item>
<key> <string>max_length</string> </key> <key> <string>max_length</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
</item> </item>
<item>
<key> <string>max_linelength</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>max_lines</string> </key>
<value> <string></string> </value>
</item>
<item> <item>
<key> <string>not_viewable</string> </key> <key> <string>not_viewable</string> </key>
<value> <int>0</int> </value> <value> <int>0</int> </value>
</item> </item>
<item>
<key> <string>parameter_list</string> </key>
<value>
<list/>
</value>
</item>
<item> <item>
<key> <string>portal_type</string> </key> <key> <string>portal_type</string> </key>
<value> <value>
<list> <list>
<tuple> <tuple>
<string>Service</string> <string>Payroll Service</string>
<string>Service</string> <string>Payroll Service</string>
</tuple> </tuple>
</list> </list>
</value> </value>
...@@ -352,9 +402,19 @@ ...@@ -352,9 +402,19 @@
<key> <string>required</string> </key> <key> <string>required</string> </key>
<value> <int>0</int> </value> <value> <int>0</int> </value>
</item> </item>
<item>
<key> <string>size</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>sort</string> </key>
<value>
<list/>
</value>
</item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>Social Service</string> </value> <value> <string>Payroll Service</string> </value>
</item> </item>
<item> <item>
<key> <string>truncate</string> </key> <key> <string>truncate</string> </key>
......
...@@ -121,7 +121,7 @@ def getGroup(group_id):\n ...@@ -121,7 +121,7 @@ def getGroup(group_id):\n
return None\n return None\n
\n \n
\n \n
def getGroupSubLineIdList(group_id=None):\n def getGroupSublineIdList(group_id=None):\n
"""\n """\n
This method get the list of subline IDs for a given group.\n This method get the list of subline IDs for a given group.\n
"""\n """\n
...@@ -136,10 +136,10 @@ def getGroupSubLineIdList(group_id=None):\n ...@@ -136,10 +136,10 @@ def getGroupSubLineIdList(group_id=None):\n
\n \n
\n \n
def sublineExist(group_id, subline_id):\n def sublineExist(group_id, subline_id):\n
return (groupExist(group_id) and subline_id not in [\'\', None] and subline_id in getGroupSubLineIdList(group_id)) and True or False\n return (groupExist(group_id) and subline_id not in [\'\', None] and subline_id in getGroupSublineIdList(group_id)) and True or False\n
\n \n
\n \n
def getSubLine(group_id, subline_id):\n def getSubline(group_id, subline_id):\n
"""\n """\n
This method get subline content based on its ID\n This method get subline content based on its ID\n
"""\n """\n
...@@ -155,7 +155,7 @@ def updateSubLine(group_id, subline_id, property, value):\n ...@@ -155,7 +155,7 @@ def updateSubLine(group_id, subline_id, property, value):\n
"""\n """\n
This method update a subline property.\n This method update a subline property.\n
"""\n """\n
subline = getSubLine(group_id, subline_id)\n subline = getSubline(group_id, subline_id)\n
if subline != None:\n if subline != None:\n
subline[property] = value\n subline[property] = value\n
return\n return\n
...@@ -195,7 +195,9 @@ for psl in context.objectValues(portal_type=\'Pay Sheet Line\'):\n ...@@ -195,7 +195,9 @@ for psl in context.objectValues(portal_type=\'Pay Sheet Line\'):\n
subline_id = "%s/%s" % (service.getId(), salary_range.getId())\n subline_id = "%s/%s" % (service.getId(), salary_range.getId())\n
\n \n
# Here we decide if a Pay Sheet Line is taxable or not, according its payroll service\n # Here we decide if a Pay Sheet Line is taxable or not, according its payroll service\n
# TODO: use a \'taxable\' category to test this in a more generic way\n # TODO: This is a hack, because the code below contain hard-coded IDs. To make this a\n
# little bit more generic, an idea could be to use a \'taxable\' category to test\n
# this in a more generic way.\n
service_id = service.getId()\n service_id = service.getId()\n
taxable = False\n taxable = False\n
if service_id.endswith(\'non_deductible\') or \\\n if service_id.endswith(\'non_deductible\') or \\\n
...@@ -230,13 +232,13 @@ for psl in context.objectValues(portal_type=\'Pay Sheet Line\'):\n ...@@ -230,13 +232,13 @@ for psl in context.objectValues(portal_type=\'Pay Sheet Line\'):\n
\n \n
\n \n
##############################################################################\n ##############################################################################\n
# Fill the \'details\' dict with cell and calculated datas.\n # Fill the \'details\' dict with cells and calculated datas.\n
# Here there is some specific code that must be modified to generic one.\n # There is some specific code here that must be transformed to generic one.\n
##############################################################################\n ##############################################################################\n
\n \n
# Get Precision and precise rounding methods\n # Get Precision and precise rounding methods\n
precision = context.getResourceValue().getQuantityPrecision()\n currency_precision = context.getResourceValue().getQuantityPrecision()\n
r_ = lambda x: context.Base_getRoundValue(x, precision)\n r_ = lambda x: context.Base_getRoundValue(x, currency_precision)\n
\n \n
# Scan each pay sheet line and save it in the right place in the data structure\n # Scan each pay sheet line and save it in the right place in the data structure\n
for psl in context.objectValues(portal_type=\'Pay Sheet Line\'):\n for psl in context.objectValues(portal_type=\'Pay Sheet Line\'):\n
...@@ -321,7 +323,7 @@ for psl in context.objectValues(portal_type=\'Pay Sheet Line\'):\n ...@@ -321,7 +323,7 @@ for psl in context.objectValues(portal_type=\'Pay Sheet Line\'):\n
updateSubLine( group_id = cell_group_id\n updateSubLine( group_id = cell_group_id\n
, subline_id = cell_subline_id\n , subline_id = cell_subline_id\n
, property = \'%s_rate\' % share_type\n , property = \'%s_rate\' % share_type\n
, value = \'%.3f %%\' % r_(cell_rate * 100.0) # The "%.3f" format is arbitrary. "3" was choose because there is no rate with precision above 3. Feel Free to update this format if required.\n , value = r_(cell_rate * 100.0)\n
)\n )\n
updateSubLine( group_id = cell_group_id\n updateSubLine( group_id = cell_group_id\n
, subline_id = cell_subline_id\n , subline_id = cell_subline_id\n
...@@ -338,6 +340,11 @@ for psl in context.objectValues(portal_type=\'Pay Sheet Line\'):\n ...@@ -338,6 +340,11 @@ for psl in context.objectValues(portal_type=\'Pay Sheet Line\'):\n
total_employee_share = r_(total_employee_share + cell_share)\n total_employee_share = r_(total_employee_share + cell_share)\n
elif share_type == \'employer\':\n elif share_type == \'employer\':\n
total_employer_share = r_(total_employer_share + cell_share)\n total_employer_share = r_(total_employer_share + cell_share)\n
\n
# Create taxable salary\n
subline = getSubline(group_id=cell_group_id, subline_id=cell_subline_id)\n
if subline != None and subline.has_key(\'taxable\') and subline[\'taxable\'] == True and subline[\'employee_share\'] != None:\n
taxable_net_salary = r_(taxable_net_salary + subline[\'employee_share\'])\n
\n \n
\n \n
\n \n
...@@ -349,7 +356,7 @@ for psl in context.objectValues(portal_type=\'Pay Sheet Line\'):\n ...@@ -349,7 +356,7 @@ for psl in context.objectValues(portal_type=\'Pay Sheet Line\'):\n
\n \n
details[\'totals\'][\'gross_salary\'] = gross_salary\n details[\'totals\'][\'gross_salary\'] = gross_salary\n
details[\'totals\'][\'net_salary\'] = net_salary\n details[\'totals\'][\'net_salary\'] = net_salary\n
details[\'totals\'][\'taxable_net_salary\'] = taxable_net_salary\n details[\'totals\'][\'taxable_net_salary\'] = r_(net_salary + taxable_net_salary)\n
details[\'totals\'][\'total_employer_share\'] = total_employer_share\n details[\'totals\'][\'total_employer_share\'] = total_employer_share\n
details[\'totals\'][\'total_employee_share\'] = total_employee_share\n details[\'totals\'][\'total_employee_share\'] = total_employee_share\n
details[\'totals\'][\'total_addendum\'] = total_addendum\n details[\'totals\'][\'total_addendum\'] = total_addendum\n
...@@ -361,26 +368,31 @@ details[\'totals\'][\'total_employee_payment\'] = r_(net_salary + total_addendum ...@@ -361,26 +368,31 @@ details[\'totals\'][\'total_employee_payment\'] = r_(net_salary + total_addendum
# Transform every float value to a string representation according the currency.\n # Transform every float value to a string representation according the currency.\n
##############################################################################\n ##############################################################################\n
\n \n
# There is 2 kind of numbers to format: rates and amounts.\n
rate_propertie_list = [\'employer_rate\', \'employee_rate\']\n
amount_propertie_list = [\'base\', \'employer_share\', \'employee_share\']\n
\n
# The "three decimals" format is arbitrary. "3" was choose because there is no rate with\n # The "three decimals" format is arbitrary. "3" was choose because there is no rate with\n
# precision above 3. Feel free to update dynamiccaly this format if required.\n # currency_precision above 3. Feel free to update dynamiccaly this format if required.\n
RATE_PRECISION = 3\n RATE_PRECISION = 3\n
\n \n
# There is 2 kind of numbers to format: rates and amounts.\n
money_format = {\'precision\': currency_precision} #IDEA: put currency symbol as suffix ?\n
rate_format = {\'precision\': RATE_PRECISION, \'suffix\': "%"}\n
property_format_dict = { \'base\' : money_format\n
, \'employer_rate\' : rate_format\n
, \'employer_share\': money_format\n
, \'employee_rate\' : rate_format\n
, \'employee_share\': money_format\n
}\n
\n
# Format each "normal" lines\n # Format each "normal" lines\n
for group_id in getPSLGroupIdList():\n for group_id in getPSLGroupIdList():\n
for subline_id in getGroupSubLineIdList(group_id=group_id):\n for subline_id in getGroupSublineIdList(group_id=group_id):\n
subline = getSubLine(group_id=group_id, subline_id=subline_id)\n subline = getSubline(group_id=group_id, subline_id=subline_id)\n
for (property, value) in subline.items():\n for (property, value) in subline.items():\n
if same_type(value, 1.0) or same_type(value, 1):\n if property_format_dict.has_key(property) and same_type(value, 1.0) or same_type(value, 1):\n
new_value = None\n format = property_format_dict[property]\n
if property in rate_propertie_list:\n precision = format[\'precision\']\n
new_value = (\'%.\' + str(RATE_PRECISION) + \'f\') % value\n
elif property in amount_propertie_list:\n
new_value = (\'%.\' + str(precision) + \'f\') % value\n new_value = (\'%.\' + str(precision) + \'f\') % value\n
if new_value != None:\n if format.has_key(\'prefix\'): new_value = \'%s %s\' % (format[\'prefix\'], new_value)\n
if format.has_key(\'suffix\'): new_value = \'%s %s\' % (new_value, format[\'suffix\'])\n
updateSubLine( group_id = group_id\n updateSubLine( group_id = group_id\n
, subline_id = subline_id\n , subline_id = subline_id\n
, property = property\n , property = property\n
...@@ -390,7 +402,7 @@ for group_id in getPSLGroupIdList():\n ...@@ -390,7 +402,7 @@ for group_id in getPSLGroupIdList():\n
# Format totals\n # Format totals\n
for (key, value) in details[\'totals\'].items():\n for (key, value) in details[\'totals\'].items():\n
if same_type(value, 1.0) or same_type(value, 1):\n if same_type(value, 1.0) or same_type(value, 1):\n
details[\'totals\'][key] = (\'%.\' + str(precision) + \'f\') % value\n details[\'totals\'][key] = (\'%.\' + str(currency_precision) + \'f\') % value\n
\n \n
\n \n
return details\n return details\n
...@@ -458,9 +470,9 @@ return details\n ...@@ -458,9 +470,9 @@ return details\n
<string>groupExist</string> <string>groupExist</string>
<string>getGroup</string> <string>getGroup</string>
<string>None</string> <string>None</string>
<string>getGroupSubLineIdList</string> <string>getGroupSublineIdList</string>
<string>sublineExist</string> <string>sublineExist</string>
<string>getSubLine</string> <string>getSubline</string>
<string>updateSubLine</string> <string>updateSubLine</string>
<string>_getiter_</string> <string>_getiter_</string>
<string>psl</string> <string>psl</string>
...@@ -483,7 +495,7 @@ return details\n ...@@ -483,7 +495,7 @@ return details\n
<string>new_subline</string> <string>new_subline</string>
<string>groups</string> <string>groups</string>
<string>old_group</string> <string>old_group</string>
<string>precision</string> <string>currency_precision</string>
<string>r_</string> <string>r_</string>
<string>cell</string> <string>cell</string>
<string>tax_category_path</string> <string>tax_category_path</string>
...@@ -496,15 +508,18 @@ return details\n ...@@ -496,15 +508,18 @@ return details\n
<string>cell_rate</string> <string>cell_rate</string>
<string>cell_base</string> <string>cell_base</string>
<string>cell_share</string> <string>cell_share</string>
<string>rate_propertie_list</string>
<string>amount_propertie_list</string>
<string>RATE_PRECISION</string>
<string>subline</string> <string>subline</string>
<string>RATE_PRECISION</string>
<string>money_format</string>
<string>rate_format</string>
<string>property_format_dict</string>
<string>property</string> <string>property</string>
<string>value</string> <string>value</string>
<string>same_type</string> <string>same_type</string>
<string>new_value</string> <string>format</string>
<string>precision</string>
<string>str</string> <string>str</string>
<string>new_value</string>
<string>key</string> <string>key</string>
</tuple> </tuple>
</value> </value>
......
...@@ -343,7 +343,7 @@ ...@@ -343,7 +343,7 @@
</tuple> </tuple>
<tuple> <tuple>
<string>description</string> <string>description</string>
<string>Comment</string> <string>Description</string>
</tuple> </tuple>
<tuple> <tuple>
<string>resource_title</string> <string>resource_title</string>
......
...@@ -316,44 +316,7 @@ ...@@ -316,44 +316,7 @@
<item> <item>
<key> <string>all_columns</string> </key> <key> <string>all_columns</string> </key>
<value> <value>
<list> <list/>
<tuple>
<string>service_title</string>
<string>Contribution</string>
</tuple>
<tuple>
<string>salary_range_title</string>
<string>Base Type</string>
</tuple>
<tuple>
<string>base</string>
<string>Base Value</string>
</tuple>
<tuple>
<string>employer_share</string>
<string>Employer Share</string>
</tuple>
<tuple>
<string>employee_share</string>
<string>Employee Share</string>
</tuple>
<tuple>
<string>description</string>
<string>Comment</string>
</tuple>
<tuple>
<string>service_id</string>
<string>Service ID</string>
</tuple>
<tuple>
<string>salary_range</string>
<string>Salary Range</string>
</tuple>
<tuple>
<string>tax_category</string>
<string>Tax Category</string>
</tuple>
</list>
</value> </value>
</item> </item>
<item> <item>
...@@ -405,7 +368,7 @@ ...@@ -405,7 +368,7 @@
</tuple> </tuple>
<tuple> <tuple>
<string>description</string> <string>description</string>
<string>Comment</string> <string>Description</string>
</tuple> </tuple>
<tuple> <tuple>
<string>service_id</string> <string>service_id</string>
...@@ -476,19 +439,19 @@ ...@@ -476,19 +439,19 @@
</tuple> </tuple>
<tuple> <tuple>
<string>description</string> <string>description</string>
<string>Comment</string> <string>Description</string>
</tuple> </tuple>
<tuple> <tuple>
<string>service_id</string> <string>service_id</string>
<string>Service ID</string> <string></string>
</tuple> </tuple>
<tuple> <tuple>
<string>salary_range</string> <string>salary_range</string>
<string>Salary Range</string> <string></string>
</tuple> </tuple>
<tuple> <tuple>
<string>tax_category</string> <string>tax_category</string>
<string>Tax Category</string> <string></string>
</tuple> </tuple>
</list> </list>
</value> </value>
......
...@@ -243,7 +243,7 @@ ...@@ -243,7 +243,7 @@
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>Comment</string> </value> <value> <string>Description</string> </value>
</item> </item>
<item> <item>
<key> <string>truncate</string> </key> <key> <string>truncate</string> </key>
......
111 115
\ 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