Commit 4c87af43 authored by Fabien Morin's avatar Fabien Morin

- fix problems related to category change (tax_category -> contribution_share)

- fix some bugs
- use business process to take the social security address in a generic way

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@29073 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent b07ac3da
......@@ -131,7 +131,7 @@ for inventory in employee_inventory_list:\n
employee_career_function=employee.getCareerFunctionTitle(),\n
salary_range=salary_range,\n
salary_range_title=salary_range_title,\n
employee_share=price,\n
employee=price,\n
base=inventory.quantity, )\n
employee_total += price\n
base_total += inventory.quantity\n
......@@ -150,7 +150,7 @@ for inventory in employer_inventory_list:\n
employee_career_reference=employee.getCareerReference(),\n
employee_title=employee.getTitle(),\n
employee_career_function=employee.getCareerFunctionTitle(),\n
employee_share=0,\n
employee=0,\n
salary_range=salary_range,\n
salary_range_title=salary_range_title,\n
base=inventory.quantity, )\n
......@@ -158,8 +158,8 @@ for inventory in employer_inventory_list:\n
i = i + 1\n
\n
employee = inventory.getDestinationValue()\n
inventory_list[key].employer_share = price\n
inventory_list[key].total = inventory_list[key].employee_share + price\n
inventory_list[key].employer = price\n
inventory_list[key].total = inventory_list[key].employee + price\n
employer_total += price\n
\n
total = employee_total + employer_total\n
......@@ -208,8 +208,8 @@ if sorted_inventory_list:\n
employee_title=translateString(\'Total ${salary_range_title}\',\n
mapping=dict(salary_range_title=current_salary_range_title)),\n
base=intermediate_base_total,\n
employee_share=intermediate_employee_total,\n
employer_share=intermediate_employer_total))\n
employee=intermediate_employee_total,\n
employer=intermediate_employer_total))\n
\n
intermediate_base_total = 0\n
intermediate_employee_total = 0\n
......@@ -219,8 +219,8 @@ if sorted_inventory_list:\n
current_salary_range_title = inventory[\'salary_range_title\']\n
\n
intermediate_base_total += inventory[\'base\']\n
intermediate_employee_total += inventory.get(\'employee_share\', 0)\n
intermediate_employer_total += inventory.get(\'employer_share\', 0)\n
intermediate_employee_total += inventory.get(\'employee\', 0)\n
intermediate_employer_total += inventory.get(\'employer\', 0)\n
new_inventory_list.append(inventory)\n
\n
if multiple_salary_range:\n
......@@ -228,8 +228,8 @@ if sorted_inventory_list:\n
employee_title=translateString(\'Total ${salary_range_title}\',\n
mapping=dict(salary_range_title=current_salary_range_title)),\n
base=intermediate_base_total,\n
employee_share=intermediate_employee_total,\n
employer_share=intermediate_employer_total))\n
employee=intermediate_employee_total,\n
employer=intermediate_employer_total))\n
\n
return new_inventory_list\n
\n
......@@ -312,7 +312,7 @@ return []\n
<string>salary_range_title</string>
<string>_inplacevar_</string>
<string>key</string>
<string>employer_share</string>
<string>employer</string>
<string>total</string>
<string>sorted_inventory_list</string>
<string>sort_method</string>
......
......@@ -57,8 +57,8 @@
\n
request = context.REQUEST\n
\n
return [Object(employee_share= request[\'employee_total\'],\n
employer_share=request[\'employer_total\'],\n
return [Object(employee= request[\'employee_total\'],\n
employer=request[\'employer_total\'],\n
base=request[\'base_total\'],\n
total= request[\'total\']\n
)\n
......
......@@ -82,8 +82,8 @@
<key> <string>hidden</string> </key>
<value>
<list>
<string>listbox_employee_share</string>
<string>listbox_employer_share</string>
<string>listbox_employee</string>
<string>listbox_employer</string>
<string>listbox_total</string>
<string>listbox_base</string>
</list>
......
......@@ -13,15 +13,15 @@
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>title</string>
<string>columns</string>
<string>list_method</string>
<string>count_method</string>
<string>stat_method</string>
<string>selection_name</string>
<string>editable_columns</string>
<string>list_method</string>
<string>search</string>
<string>select</string>
<string>editable_columns</string>
<string>selection_name</string>
<string>stat_method</string>
<string>title</string>
</list>
</value>
</item>
......@@ -107,11 +107,11 @@
<string>Base</string>
</tuple>
<tuple>
<string>employee_share</string>
<string>employee</string>
<string>Employee Share</string>
</tuple>
<tuple>
<string>employer_share</string>
<string>employer</string>
<string>Employer Share</string>
</tuple>
<tuple>
......@@ -134,11 +134,11 @@
<string>Base</string>
</tuple>
<tuple>
<string>employee_share</string>
<string>employee</string>
<string>Employee Share</string>
</tuple>
<tuple>
<string>employer_share</string>
<string>employer</string>
<string>Employer Share</string>
</tuple>
<tuple>
......
......@@ -19,7 +19,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>listbox_employee_share</string> </value>
<value> <string>listbox_employee</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
......
......@@ -19,7 +19,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>listbox_employer_share</string> </value>
<value> <string>listbox_employer</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
......
......@@ -70,10 +70,10 @@ property_list = [ \'slice\',\n
\'base_application_list\',\n
\'base_name\',\n
\'base\',\n
\'employer_share_price\',\n
\'employer_share_quantity\',\n
\'employee_share_price\',\n
\'employee_share_quantity\',\n
\'employer_price\',\n
\'employer_quantity\',\n
\'employee_price\',\n
\'employee_quantity\',\n
\'causality\',\n
]\n
for line in line_list:\n
......@@ -84,8 +84,8 @@ for line in line_list:\n
\'source_section_title\': line.getSourceSectionTitle(),\n
\'title\' : line.getTitle(),\n
\'service\' : getattr(line, \'service\', None),\n
\'employer_share_total_price\' : getattr(line, \'employer_share_total_price\', None),\n
\'employee_share_total_price\' : getattr(line, \'employee_share_total_price\', None),\n
\'employer_total_price\' : getattr(line, \'employer_total_price\', None),\n
\'employee_total_price\' : getattr(line, \'employee_total_price\', None),\n
}\n
\n
addProperties(line=line, line_dict=line_dict, property_list=property_list)\n
......
......@@ -78,8 +78,8 @@ if not editable:\n
# this following columns are add for both edibales and not\n
for model_line in context.contentValues(portal_type=\'Pay Sheet Line\'):\n
for contribution_share in model_line.getContributionShareValueList():\n
price = (contribution_share.getId()+\'_share_price\', contribution_share.getTitle()+\' Share Rate\')\n
quantity = (contribution_share.getId()+\'_share_total_price\', \n
price = (contribution_share.getId()+\'_price\', contribution_share.getTitle()+\' Share Rate\')\n
quantity = (contribution_share.getId()+\'_total_price\', \n
contribution_share.getTitle()+\' Share Amount\')\n
if price not in column_list:\n
column_list.append(price)\n
......
......@@ -119,9 +119,9 @@ for paysheet_line in paysheet_line_list:\n
\n
base = cell.getQuantity()\n
\n
share_dict[cell.getContributionShare()+\'_share_price\'] = cell.getPrice()\n
share_dict[cell.getContributionShare()+\'_share_quantity\'] = cell.getQuantity()\n
share_dict[cell.getContributionShare()+\'_share_total_price\'] = \\\n
share_dict[cell.getContributionShare()+\'_price\'] = cell.getPrice()\n
share_dict[cell.getContributionShare()+\'_quantity\'] = cell.getQuantity()\n
share_dict[cell.getContributionShare()+\'_total_price\'] = \\\n
round(cell.getTotalPrice(), precision)\n
\n
tuple_dict = {}\n
......
......@@ -53,7 +53,9 @@
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>translateString = context.Base_translateString\n
<value> <string encoding="cdata"><![CDATA[
translateString = context.Base_translateString\n
model = context.getSpecialiseValue().getEffectiveModel(\\\n
start_date=context.getStartDate(), stop_date=context.getStopDate())\n
\n
......@@ -144,6 +146,28 @@ def getPaymentConditionText(order):\n
return \'%s %s\' % (days, translateString(\'Days\'))\n
return \'\'\n
\n
def getSocialOrganisationValue():\n
model = context.getSpecialiseValue()\n
business_process_list = model.findSpecialiseValueList(\\\n
context=context, portal_type_list=[\'Business Process\'])\n
business_process = None\n
if len(business_process_list):\n
# XXX currently, is too complicated to use more than\n
# one Business Process, so the first (which is the nearest from the\n
# delivery) is took\n
business_process = business_process_list[0]\n
business_path_list = business_process.getPathValueList(trade_phase=\\\n
\'payroll/invoicing/social_security\')\n
if len(business_path_list) > 1:\n
raise NotImplementedError, \'For now, it can not support more \'\\\n
\'than one business_path with same trade_phase. \'\\\n
\'%s have same trade_phase\' % repr(business_path_list)\n
if len(business_path_list) == 1:\n
business_path = business_path_list[0]\n
return business_path.getSourceSectionValue()\n
\n
return None\n
\n
\n
line_list = []\n
total_price = 0.0\n
......@@ -329,16 +353,10 @@ data_dict = {\n
context.getDestinationSectionValue().getProperty(\'activity_code\') or \'\'),\n
\'destination_section_social_codeid\': getSocialCodeId(context.getDestinationSection() and\n
context.getDestinationSectionValue().getProperty(\'social_code\') or \'\'),\n
\'destination_section_social_company_title\' : context.getSocialInsuranceAnnotationLineValue() is not None and \\\n
context.getSocialInsuranceAnnotationLineValue().getSourceTitle() or \'\',\n
\'destination_section_social_address\': getOneLineAddress(\n
context.getSocialInsuranceAnnotationLineValue() is not None and \\\n
context.getSocialInsuranceAnnotationLineValue().getSource() and \\\n
context.getSocialInsuranceAnnotationLineValue().getSourceValue().getDefaultAddressText() or \'\',\n
context.getSocialInsuranceAnnotationLineValue() is not None and \\\n
context.getSocialInsuranceAnnotationLineValue().getSource() and \\\n
context.getSocialInsuranceAnnotationLineValue().getSourceValue().getDefaultAddressRegionTitle() or \'\'),\n
\n
\'destination_section_social_company_title\' : getSocialOrganisationValue() is not None and getSocialOrganisationValue().getTitle() or \'\',\n
\'destination_section_social_address\': getSocialOrganisationValue() is not None and getOneLineAddress(\\\n
getSocialOrganisationValue().getDefaultAddressText(),\n
getSocialOrganisationValue().getDefaultAddressRegionTitle()) or \'\',\n
\'destination_administration_title\':\\\n
destination_administration.getProperty(\'corporate_name\') or \\\n
destination_administration.getTitle(),\n
......@@ -370,7 +388,9 @@ data_dict = {\n
}\n
\n
return unicodeDict(data_dict)\n
</string> </value>
]]></string> </value>
</item>
<item>
<key> <string>_code</string> </key>
......@@ -425,6 +445,7 @@ return unicodeDict(data_dict)\n
<string>separator</string>
<string>getOrderedDate</string>
<string>getPaymentConditionText</string>
<string>getSocialOrganisationValue</string>
<string>line_list</string>
<string>total_price</string>
<string>total_vat</string>
......
......@@ -74,11 +74,12 @@ portal_simulation = portal.portal_simulation\n
\n
base_amount = portal.portal_categories.base_amount\n
\n
base_contribution_uid_list = []\n
for category in base_contribution_list:\n
category_value = getattr(base_amount, category, None)\n
category_value = base_amount.restrictedTraverse(category)\n
if category_value is None:\n
raise ValueError, \'Category "%s/%s" not found.\' % (base_amount.getPath(), category)\n
base_contribution_uid_list = category_value.getUid()\n
base_contribution_uid_list.append(category_value.getUid())\n
\n
params = {\n
\'node_uid\' : paysheet.getSourceSectionUid(),\n
......@@ -140,12 +141,11 @@ return portal_simulation.getInventoryAssetPrice(**params)\n
<string>portal</string>
<string>portal_simulation</string>
<string>base_amount</string>
<string>base_contribution_uid_list</string>
<string>_getiter_</string>
<string>category</string>
<string>getattr</string>
<string>category_value</string>
<string>ValueError</string>
<string>base_contribution_uid_list</string>
<string>DateTime</string>
<string>params</string>
<string>_apply_</string>
......
......@@ -85,10 +85,10 @@
<value>
<list>
<string>listbox_base</string>
<string>listbox_employee_share_price</string>
<string>listbox_employer_share_price</string>
<string>listbox_employee_share_total_price</string>
<string>listbox_employer_share_total_price</string>
<string>listbox_employee_price</string>
<string>listbox_employer_price</string>
<string>listbox_employee_total_price</string>
<string>listbox_employer_total_price</string>
<string>listbox_int_index</string>
<string>listbox_title</string>
</list>
......
......@@ -19,7 +19,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>listbox_employee_share_price</string> </value>
<value> <string>listbox_employee_price</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
......
......@@ -24,7 +24,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>listbox_employer_share_total_price</string> </value>
<value> <string>listbox_employee_total_price</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
......
......@@ -19,7 +19,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>listbox_employer_share_price</string> </value>
<value> <string>listbox_employer_price</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
......
......@@ -24,7 +24,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>listbox_employee_share_total_price</string> </value>
<value> <string>listbox_employer_total_price</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
......
......@@ -414,13 +414,13 @@ AAA=</string> </value>
<!-- If previous line has \'base_salary\' category in its\n
base_contribution list and the next one don\'t have, display the total\n
gross_salary -->\n
<tal:block condition="python: previous_line is not None and \'base_amount/gross_salary\' in previous_line[\'base_contribution_list\'] and \'base_amount/gross_salary\' not in line_dict[\'base_contribution_list\']">\n
<tal:block condition="python: previous_line is not None and \'base_amount/payroll/earning/salary/gross_salary\' in previous_line[\'base_contribution_list\'] and \'base_amount/payroll/earning/salary/gross_salary\' not in line_dict[\'base_contribution_list\']">\n
<table:table-row table:style-name=\'Tableau1.3\'>\n
<table:table-cell table:style-name=\'Tableau1.A8\' office:value-type=\'string\'>\n
<text:p text:style-name=\'Item_20_Table_20_Title_20_Left\' tal:content=\'python: here.Base_translateString("Gross Salary")\'>1</text:p>\n
</table:table-cell>\n
<table:table-cell table:style-name=\'Tableau1.A8\' office:value-type=\'string\'>\n
<text:p text:style-name=\'Table_20_Contents_20_Right\' tal:content=\'python:quantity_renderer(context.PaySheetTransaction_getMovementTotalPriceFromCategory(base_contribution="base_contribution/base_amount/gross_salary"))\'>400 000</text:p>\n
<text:p text:style-name=\'Table_20_Contents_20_Right\' tal:content=\'python:quantity_renderer(context.PaySheetTransaction_getMovementTotalPriceFromCategory(base_contribution="base_contribution/base_amount/payroll/earning/salary/gross_salary"))\'>400 000</text:p>\n
</table:table-cell>\n
<table:table-cell table:style-name=\'Tableau1.A8\' office:value-type=\'string\'>\n
<text:p text:style-name=\'Table_20_Contents\'/>\n
......@@ -495,62 +495,62 @@ AAA=</string> </value>
\n
<table:table-cell table:style-name=\'Tableau1.A3\'\n
office:value-type=\'float\'\n
tal:condition="python: line_dict[\'employee_share_price\'] != None"\n
tal:attributes=\'office:value line_dict/employee_share_price\'> \n
tal:condition="python: line_dict[\'employee_price\'] != None"\n
tal:attributes=\'office:value line_dict/employee_price\'> \n
<text:p text:style-name=\'Table_20_Contents\'\n
tal:content="python: price_renderer(line_dict[\'employee_share_price\'])"\n
tal:content="python: price_renderer(line_dict[\'employee_price\'])"\n
tal:attributes=\'text:style-name right_style_name\'>employee price</text:p>\n
</table:table-cell>\n
<table:table-cell table:style-name=\'Tableau1.A3\'\n
office:value-type=\'string\'\n
tal:condition="python: line_dict[\'employee_share_price\'] == None"> \n
tal:condition="python: line_dict[\'employee_price\'] == None"> \n
<text:p text:style-name=\'Table_20_Contents\'/>\n
</table:table-cell>\n
\n
<table:table-cell table:style-name=\'Tableau1.A3\'\n
office:value-type=\'float\'\n
tal:condition="python: line_dict[\'employee_share_total_price\'] != None"\n
tal:attributes=\'office:value line_dict/employee_share_total_price\'> \n
tal:condition="python: line_dict[\'employee_total_price\'] != None"\n
tal:attributes=\'office:value line_dict/employee_total_price\'> \n
<text:p text:style-name=\'Table_20_Contents\'\n
tal:content="python: quantity_renderer(line_dict[\'employee_share_total_price\'])"\n
tal:content="python: quantity_renderer(line_dict[\'employee_total_price\'])"\n
tal:attributes=\'text:style-name right_style_name\'>employee total price</text:p>\n
</table:table-cell>\n
<table:table-cell table:style-name=\'Tableau1.A3\'\n
office:value-type=\'string\'\n
tal:condition="python: line_dict[\'employee_share_total_price\'] == None"> \n
tal:condition="python: line_dict[\'employee_total_price\'] == None"> \n
<text:p text:style-name=\'Table_20_Contents\'/>\n
</table:table-cell>\n
\n
<!-- if this line not contribute to gross_salary base amount display employer share else don\'t display it-->\n
<tal:block tal:condition="python: \'base_amount/gross_salary\' not in line_dict[\'base_contribution_list\']">\n
<tal:block tal:condition="python: \'base_amount/payroll/earning/salary/gross_salary\' not in line_dict[\'base_contribution_list\']">\n
<table:table-cell table:style-name=\'Tableau1.A3\'\n
office:value-type=\'float\'\n
tal:condition="python: line_dict[\'employer_share_price\'] != None"\n
tal:attributes=\'office:value line_dict/employer_share_price\'> \n
tal:condition="python: line_dict[\'employer_price\'] != None"\n
tal:attributes=\'office:value line_dict/employer_price\'> \n
<text:p text:style-name=\'Table_20_Contents\'\n
tal:content="python: price_renderer(line_dict[\'employer_share_price\'])"\n
tal:content="python: price_renderer(line_dict[\'employer_price\'])"\n
tal:attributes=\'text:style-name right_style_name\'>employer price</text:p>\n
</table:table-cell>\n
<table:table-cell table:style-name=\'Tableau1.A3\'\n
office:value-type=\'string\'\n
tal:condition="python: line_dict[\'employer_share_price\'] == None"> \n
tal:condition="python: line_dict[\'employer_price\'] == None"> \n
<text:p text:style-name=\'Table_20_Contents\'/>\n
</table:table-cell>\n
<table:table-cell table:style-name=\'Tableau1.A3\'\n
office:value-type=\'float\'\n
tal:condition="python: line_dict[\'employer_share_total_price\'] != None"\n
tal:attributes=\'office:value line_dict/employer_share_total_price\'> \n
tal:condition="python: line_dict[\'employer_total_price\'] != None"\n
tal:attributes=\'office:value line_dict/employer_total_price\'> \n
<text:p text:style-name=\'Table_20_Contents\'\n
tal:content="python: quantity_renderer(line_dict[\'employer_share_total_price\'])"\n
tal:content="python: quantity_renderer(line_dict[\'employer_total_price\'])"\n
tal:attributes=\'text:style-name right_style_name\'>employer total price</text:p>\n
</table:table-cell>\n
<table:table-cell table:style-name=\'Tableau1.A3\'\n
office:value-type=\'string\'\n
tal:condition="python: line_dict[\'employer_share_total_price\'] == None"> \n
tal:condition="python: line_dict[\'employer_total_price\'] == None"> \n
<text:p text:style-name=\'Table_20_Contents\'/>\n
</table:table-cell>\n
</tal:block>\n
<tal:block tal:condition="python: \'base_amount/gross_salary\' in line_dict[\'base_contribution_list\']">\n
<tal:block tal:condition="python: \'base_amount/payroll/earning/salary/gross_salary\' in line_dict[\'base_contribution_list\']">\n
<table:table-cell table:style-name=\'Tableau1.A3\' office:value-type=\'string\'>\n
<text:p text:style-name=\'Table_20_Contents\'/>\n
</table:table-cell>\n
......@@ -615,7 +615,7 @@ AAA=</string> </value>
<table:table-cell table:style-name=\'Tableau3.E2\'\n
office:value-type=\'float\'\n
tal:attributes=\'office:value data_dict/total_price_novat\'>\n
<text:p text:style-name=\'Item_20_Table_20_Title_20_Right\' tal:content="python: \'%s %s\' % (quantity_renderer(context.PaySheetTransaction_getMovementTotalPriceFromCategory(base_contribution=\'base_contribution/base_amount/net_salary\', contribution_share=\'contribution_share/employee\')), data_dict[\'currency\'])">800.000,00</text:p>\n
<text:p text:style-name=\'Item_20_Table_20_Title_20_Right\' tal:content="python: \'%s %s\' % (quantity_renderer(context.PaySheetTransaction_getMovementTotalPriceFromCategory(base_contribution=\'base_contribution/base_amount/payroll/earning/salary/net_salary\', contribution_share=\'contribution_share/employee\')), data_dict[\'currency\'])">800.000,00</text:p>\n
</table:table-cell>\n
</table:table-row>\n
<table:table-row table:style-name=\'Tableau1.4\'>\n
......
......@@ -79,16 +79,16 @@ for line in line_dict_list:\n
string_to_display.append(rightPad(line[\'title\'], 40))\n
string_to_display.append(rightPad(line[\'base\'], 16))\n
\n
if line.has_key(\'employer_share_quantity\'):\n
string_to_display.append(rightPad(str(line[\'employer_share_price\']), 24))\n
string_to_display.append(rightPad(str(line[\'employer_share_quantity\']), 24))\n
if line.has_key(\'employer_quantity\'):\n
string_to_display.append(rightPad(str(line[\'employer_price\']), 24))\n
string_to_display.append(rightPad(str(line[\'employer_quantity\']), 24))\n
else:\n
string_to_display.append(rightPad(\' \', 24))\n
string_to_display.append(rightPad(\' \', 24))\n
\n
if line.has_key(\'employee_share_quantity\'):\n
string_to_display.append(rightPad(str(line[\'employee_share_price\']), 24))\n
string_to_display.append(rightPad(str(line[\'employee_share_quantity\']), 24))\n
if line.has_key(\'employee_quantity\'):\n
string_to_display.append(rightPad(str(line[\'employee_price\']), 24))\n
string_to_display.append(rightPad(str(line[\'employee_quantity\']), 24))\n
else:\n
string_to_display.append(rightPad(\' \', 24))\n
string_to_display.append(rightPad(\' \', 24))\n
......
531
\ No newline at end of file
530
\ 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