Commit 2a1af9d0 authored by Julien Muchembled's avatar Julien Muchembled

payroll: fix cumulated taxable net salary in reports

parent 574db1a7
...@@ -182,13 +182,12 @@ def getPaymentConditionText(paysheet):\n ...@@ -182,13 +182,12 @@ def getPaymentConditionText(paysheet):\n
date)\n date)\n
return \'\'\n return \'\'\n
\n \n
gross_salary = getMovementTotalPriceFromCategory(\\\n base_contribution = \'base_contribution/base_amount/payroll/report/salary/gross\'\n
base_contribution=\'base_contribution/base_amount/payroll/report/salary/gross\',\n gross_salary = getMovementTotalPriceFromCategory(base_contribution,\n
contribution_share=\'contribution_share/employee\')\n contribution_share=\'contribution_share/employee\')\n
\n year_to_date_gross_salary = paysheet.PaySheetTransaction_getYearToDateSlice(base_contribution)\n
year_to_date_gross_salary = paysheet.PaySheetTransaction_getYearToDateSlice()\n year_to_date_slice_a = paysheet.PaySheetTransaction_getYearToDateSlice(base_contribution, \'salary_range/france/tranche_a\')\n
year_to_date_slice_a = paysheet.PaySheetTransaction_getYearToDateSlice(\'salary_range/france/tranche_a\')\n year_to_date_slice_b = paysheet.PaySheetTransaction_getYearToDateSlice(base_contribution, \'salary_range/france/tranche_b\')\n
year_to_date_slice_b = paysheet.PaySheetTransaction_getYearToDateSlice(\'salary_range/france/tranche_b\')\n
\n \n
worked_hour_count = paysheet.getWorkTimeAnnotationLineQuantity(0)\n worked_hour_count = paysheet.getWorkTimeAnnotationLineQuantity(0)\n
year_to_date_worked_hour_count = worked_hour_count + \\\n year_to_date_worked_hour_count = worked_hour_count + \\\n
...@@ -208,8 +207,8 @@ year_to_date_bonus_worked_hour_amount = portal.PaySheetTransaction_getYearToDate ...@@ -208,8 +207,8 @@ year_to_date_bonus_worked_hour_amount = portal.PaySheetTransaction_getYearToDate
base_contribution=\'base_contribution/base_amount/payroll/report/overtime\', \\\n base_contribution=\'base_contribution/base_amount/payroll/report/overtime\', \\\n
contribution_share=\'contribution_share/employee\') or 0\n contribution_share=\'contribution_share/employee\') or 0\n
\n \n
year_to_date_taxable_net_salary = portal.PaySheetTransaction_getYearToDateBaseContributionTotalPrice(\\\n year_to_date_taxable_net_salary = paysheet.PaySheetTransaction_getYearToDateSlice(\n
paysheet=paysheet, base_contribution_list=\'payroll/report/salary/net\') + salaire_net_imposable\n \'base_contribution/base_amount/payroll/base/income_tax\')\n
\n \n
def unicodeDict(d):\n def unicodeDict(d):\n
for k, v in d.items():\n for k, v in d.items():\n
......
...@@ -50,9 +50,7 @@ ...@@ -50,9 +50,7 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string encoding="cdata"><![CDATA[ <value> <string>\'\'\'\n
\'\'\'\n
This script get year to date amount for the slice corresponding to slice_path\n This script get year to date amount for the slice corresponding to slice_path\n
of the model.\n of the model.\n
\'\'\'\n \'\'\'\n
...@@ -73,12 +71,12 @@ paysheet_list = [r.getObject() for r in accounting_module.searchFolder(**search_ ...@@ -73,12 +71,12 @@ paysheet_list = [r.getObject() for r in accounting_module.searchFolder(**search_
paysheet_list.append(context)\n paysheet_list.append(context)\n
yearly_slice_amount = 0\n yearly_slice_amount = 0\n
\n \n
for paysheet in paysheet_list :\n for paysheet in paysheet_list:\n
gross_salary=paysheet.PaySheetTransaction_getMovementTotalPriceFromCategory(\\\n salary = paysheet.PaySheetTransaction_getMovementTotalPriceFromCategory(\n
base_contribution=\'base_contribution/base_amount/payroll/report/salary/gross\',\n base_contribution=base_contribution,\n
contribution_share=\'contribution_share/employee\')\n contribution_share=\'contribution_share/employee\')\n
if slice_path is None:\n if slice_path is None:\n
yearly_slice_amount += gross_salary\n yearly_slice_amount += salary\n
continue\n continue\n
model = paysheet.getSpecialiseValue().getEffectiveModel(\\\n model = paysheet.getSpecialiseValue().getEffectiveModel(\\\n
start_date=paysheet.getStartDate(),\n start_date=paysheet.getStartDate(),\n
...@@ -89,21 +87,14 @@ for paysheet in paysheet_list :\n ...@@ -89,21 +87,14 @@ for paysheet in paysheet_list :\n
return 0.0\n return 0.0\n
plafond_max = slice.getQuantityRangeMax()\n plafond_max = slice.getQuantityRangeMax()\n
plafond_min = slice.getQuantityRangeMin()\n plafond_min = slice.getQuantityRangeMin()\n
slice_amount = 0\n yearly_slice_amount += min(salary, plafond_max) - plafond_min\n
if gross_salary < plafond_max:\n
slice_amount = gross_salary - plafond_min\n
else:\n
slice_amount = plafond_max - plafond_min\n
yearly_slice_amount += slice_amount\n
\n \n
return yearly_slice_amount\n return yearly_slice_amount\n
</string> </value>
]]></string> </value>
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>slice_path=None</string> </value> <value> <string>base_contribution, slice_path=None</string> </value>
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
......
141 142
\ No newline at end of file \ No newline at end of file
...@@ -77,6 +77,7 @@ class TestPayroll_l10n_fr(TestPayrollMixin): ...@@ -77,6 +77,7 @@ class TestPayroll_l10n_fr(TestPayrollMixin):
paysheet.stop() paysheet.stop()
self.tic() self.tic()
base_contribution = 'base_contribution/base_amount/payroll/report/salary/gross'
# here, check how much is contributed to the slices # here, check how much is contributed to the slices
# the slices defined for this tax are : # the slices defined for this tax are :
# - 0 to 200 # - 0 to 200
...@@ -84,14 +85,14 @@ class TestPayroll_l10n_fr(TestPayrollMixin): ...@@ -84,14 +85,14 @@ class TestPayroll_l10n_fr(TestPayrollMixin):
# - 400 to 5000 # - 400 to 5000
# the salary is of 3000 # the salary is of 3000
self.assertEquals(400, # 200 from the 1st paysheet + 200 from the 2e self.assertEquals(400, # 200 from the 1st paysheet + 200 from the 2e
paysheet_list[1].PaySheetTransaction_getYearToDateSlice(\ paysheet_list[1].PaySheetTransaction_getYearToDateSlice(
'salary_range/france/slice_0_to_200')) base_contribution, 'salary_range/france/slice_0_to_200'))
self.assertEquals(400, # 200 from the 1st paysheet + 200 from the 2e self.assertEquals(400, # 200 from the 1st paysheet + 200 from the 2e
paysheet_list[1].PaySheetTransaction_getYearToDateSlice(\ paysheet_list[1].PaySheetTransaction_getYearToDateSlice(\
'salary_range/france/slice_200_to_400')) base_contribution, 'salary_range/france/slice_200_to_400'))
self.assertEquals(5200, # (3000 - 400)*2 self.assertEquals(5200, # (3000 - 400)*2
paysheet_list[1].PaySheetTransaction_getYearToDateSlice(\ paysheet_list[1].PaySheetTransaction_getYearToDateSlice(\
'salary_range/france/slice_400_to_5000')) base_contribution, 'salary_range/france/slice_400_to_5000'))
def test_01_getYearToDateSlice(self): def test_01_getYearToDateSlice(self):
'''Check that is possible to calculate the total amount spend on a slice '''Check that is possible to calculate the total amount spend on a slice
......
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