Commit c80cf7a4 authored by Nicolas Wavrant's avatar Nicolas Wavrant

erp5_payroll_l10n_fr : adds year-to-date employer taxes to payslip's footer

parent 469b7d50
...@@ -130,6 +130,7 @@ total_employee_tax = getMovementTotalPriceFromCategory(\\\n ...@@ -130,6 +130,7 @@ total_employee_tax = getMovementTotalPriceFromCategory(\\\n
include_empty_contribution=False,\n include_empty_contribution=False,\n
excluded_reference_list=[\'ticket_restaurant\',],\n excluded_reference_list=[\'ticket_restaurant\',],\n
contribution_share=\'contribution_share/employee\')\n contribution_share=\'contribution_share/employee\')\n
\n
def getTotalEmployeeTaxId(total_employee_tax):\n def getTotalEmployeeTaxId(total_employee_tax):\n
s = \'\'\n s = \'\'\n
if total_employee_tax:\n if total_employee_tax:\n
...@@ -149,6 +150,11 @@ def getTotalEmployerTaxId(total_employer_tax):\n ...@@ -149,6 +150,11 @@ def getTotalEmployerTaxId(total_employer_tax):\n
quantity_renderer(total_employer_tax*-1))\n quantity_renderer(total_employer_tax*-1))\n
return s\n return s\n
\n \n
year_to_date_total_employer_tax = paysheet.PaySheetTransaction_getYearToDateMovementTotalPriceFromCategory(\\\n
no_base_contribution=True,\n
include_empty_contribution=False,\n
excluded_reference_list=[\'ticket_restaurant\',],\n
contribution_share=\'contribution_share/employer\')\n
\n \n
preferred_date_order = portal.portal_preferences\\\n preferred_date_order = portal.portal_preferences\\\n
.getPreferredDateOrder() or \'ymd\'\n .getPreferredDateOrder() or \'ymd\'\n
...@@ -254,6 +260,7 @@ data_dict = {\n ...@@ -254,6 +260,7 @@ data_dict = {\n
\'salaire_net_imposable\': getTaxableNetPayId(salaire_net_imposable),\n \'salaire_net_imposable\': getTaxableNetPayId(salaire_net_imposable),\n
\'total_employee_tax\': getTotalEmployeeTaxId(total_employee_tax),\n \'total_employee_tax\': getTotalEmployeeTaxId(total_employee_tax),\n
\'total_employer_tax\': getTotalEmployerTaxId(total_employer_tax),\n \'total_employer_tax\': getTotalEmployerTaxId(total_employer_tax),\n
\'year_to_date_total_employer_tax\': year_to_date_total_employer_tax,\n
}\n }\n
\n \n
return unicodeDict(data_dict)\n return unicodeDict(data_dict)\n
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </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>\'\'\'\n
This script will call the PaySheetTransaction_getMovementTotalPriceFromCategory\n
script to get the year to date summed amount of paysheet lines wich category of\n
category_list parameter is in variation_category_list of the PaySheet line and \n
wich has a base_contribution in the base_contribution_list\n
\'\'\'\n
\n
portal = context.getPortalObject()\n
accounting_module = portal.accounting_module\n
\n
from_date=DateTime(context.getStartDate().year(), 1, 1)\n
to_date=context.getStartDate()\n
\n
search_params = {\n
\'portal_type\' : \'Pay Sheet Transaction\',\n
\'delivery.start_date\' : {\'range\': "minmax", \'query\': (from_date, to_date)},\n
\'delivery.source_section_uid\' : context.getSourceSectionUid(),\n
\'simulation_state\' : [\'confirmed\', \'stopped\', \'delivered\']\n
}\n
\n
paysheet_list = [r.getObject() for r in accounting_module.searchFolder(**search_params)]\n
paysheet_list.append(context)\n
\n
yearly_amount = 0.\n
\n
script_params = {\'base_contribution\': base_contribution,\n
\'contribution_share\': contribution_share,\n
\'no_base_contribution\': no_base_contribution,\n
\'include_empty_contribution\': include_empty_contribution,\n
\'excluded_reference_list\': excluded_reference_list}\n
\n
for paysheet in paysheet_list :\n
monthly_amount = paysheet.PaySheetTransaction_getMovementTotalPriceFromCategory(**script_params)\n
yearly_amount += monthly_amount\n
\n
return yearly_amount * -1\n
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>base_contribution=None, contribution_share=None, no_base_contribution=False, include_empty_contribution=True, excluded_reference_list=None</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>PaySheetTransaction_getYearToDateMovementTotalPriceFromCategory</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -196,7 +196,7 @@ ...@@ -196,7 +196,7 @@
<text:p text:style-name=\'Item_20_Table_20_Title\'><span tal:replace=\'orig_message\'/></text:p>\n <text:p text:style-name=\'Item_20_Table_20_Title\'><span tal:replace=\'orig_message\'/></text:p>\n
<text:p text:style-name=\'Item_20_Table_20_Title\' tal:condition=\'python:translated_message != orig_message\'><span tal:replace=\'translated_message\'/></text:p>\n <text:p text:style-name=\'Item_20_Table_20_Title\' tal:condition=\'python:translated_message != orig_message\'><span tal:replace=\'translated_message\'/></text:p>\n
</table:table-cell>\n </table:table-cell>\n
<table:table-cell table:style-name=\'Tableau1.A6\' office:value-type=\'string\' tal:define=\'orig_string string:Rémunération Heures supp.; orig_message python:unicode(here.Base_translateString(orig_string, lang=default_language),"utf-8"); translated_message python:unicode(here.Base_translateString(orig_string),"utf-8")\'>\n <table:table-cell table:style-name=\'Tableau1.A6\' office:value-type=\'string\' tal:define=\'orig_string string:Cotisations patronales; orig_message python:unicode(here.Base_translateString(orig_string, lang=default_language),"utf-8"); translated_message python:unicode(here.Base_translateString(orig_string),"utf-8")\'>\n
<text:p text:style-name=\'Item_20_Table_20_Title\'><span tal:replace=\'orig_message\'/></text:p>\n <text:p text:style-name=\'Item_20_Table_20_Title\'><span tal:replace=\'orig_message\'/></text:p>\n
<text:p text:style-name=\'Item_20_Table_20_Title\' tal:condition=\'python:translated_message != orig_message\'><span tal:replace=\'translated_message\'/></text:p>\n <text:p text:style-name=\'Item_20_Table_20_Title\' tal:condition=\'python:translated_message != orig_message\'><span tal:replace=\'translated_message\'/></text:p>\n
</table:table-cell>\n </table:table-cell>\n
...@@ -268,15 +268,15 @@ ...@@ -268,15 +268,15 @@
\n \n
<table:table-cell table:style-name=\'Tableau1.A8\'\n <table:table-cell table:style-name=\'Tableau1.A8\'\n
office:value-type=\'float\'\n office:value-type=\'float\'\n
tal:condition="python: data_dict[\'year_to_date_bonus_worked_hour_amount\']"\n tal:condition="python: data_dict[\'year_to_date_total_employer_tax\']"\n
tal:attributes=\'office:value data_dict/year_to_date_bonus_worked_hour_amount\'> \n tal:attributes=\'office:value data_dict/year_to_date_total_employer_tax\'> \n
<text:p text:style-name=\'Table_20_Contents\'\n <text:p text:style-name=\'Table_20_Contents\'\n
tal:content="python: quantity_renderer(data_dict[\'year_to_date_bonus_worked_hour_amount\'])"\n tal:content="python: quantity_renderer(data_dict[\'year_to_date_total_employer_tax\'])"\n
tal:attributes=\'text:style-name right_style_name\'>300000</text:p>\n tal:attributes=\'text:style-name right_style_name\'>300000</text:p>\n
</table:table-cell> \n </table:table-cell> \n
<table:table-cell table:style-name=\'Tableau1.A8\'\n <table:table-cell table:style-name=\'Tableau1.A8\'\n
office:value-type=\'string\'\n office:value-type=\'string\'\n
tal:condition="python: not data_dict[\'year_to_date_bonus_worked_hour_amount\']"> \n tal:condition="python: not data_dict[\'year_to_date_total_employer_tax\']"> \n
<text:p text:style-name=\'Table_20_Contents\'/>\n <text:p text:style-name=\'Table_20_Contents\'/>\n
</table:table-cell>\n </table:table-cell>\n
\n \n
......
5.4.7 5.4.8
\ 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