Commit 4c59a549 authored by Nicolas Wavrant's avatar Nicolas Wavrant

erp5_payroll_l10n_fr: declares CTP 801 and 059 with correct signs

parent 924411f0
...@@ -205,7 +205,8 @@ if block_id == 'S21.G00.23': ...@@ -205,7 +205,8 @@ if block_id == 'S21.G00.23':
if target['code'][:3] != '801': if target['code'][:3] != '801':
assert target['quantity'] > 0 assert target['quantity'] > 0
else: else:
assert target['quantity'] < 0 target['quantity'] = target['quantity'] * -1.
assert target['quantity'] > 0
rubric_value_dict['S21.G00.23.005'] = formatFloat(round(target['quantity'])) rubric_value_dict['S21.G00.23.005'] = formatFloat(round(target['quantity']))
else: else:
rubric_value_dict['S21.G00.23.004'] = formatFloat(round(target['base'])) rubric_value_dict['S21.G00.23.004'] = formatFloat(round(target['base']))
......
...@@ -56,7 +56,7 @@ INSEE_CODE = getINSEECode(ZIP_CODE) ...@@ -56,7 +56,7 @@ INSEE_CODE = getINSEECode(ZIP_CODE)
def makeCTPBlock(movement, category): def makeCTPBlock(movement, category):
quantity = 0. quantity = 0.
if category[:3] in ('437', '671'): if category[:3] in ('437', '671', '801'):
quantity = getattr(movement, 'employer_total_price', 0.) + getattr(movement, 'employee_total_price', 0.) quantity = getattr(movement, 'employer_total_price', 0.) + getattr(movement, 'employee_total_price', 0.)
return { return {
'code': category, 'code': category,
...@@ -106,11 +106,17 @@ def makeTaxableBaseComponentBlock(movement, category): ...@@ -106,11 +106,17 @@ def makeTaxableBaseComponentBlock(movement, category):
def makeIndividualContributionBlock(movement, category): def makeIndividualContributionBlock(movement, category):
base = quantity = 0.0 base = quantity = 0.0
if category in ('018', '063', '064', '059'): if category in ('018', '063', '064'):
quantity = (getattr(movement, 'employer_total_price', 0) + getattr(movement, 'employee_total_price', 0)) * -1 quantity = (getattr(movement, 'employer_total_price', 0) + getattr(movement, 'employee_total_price', 0)) * -1
if category == '018': # If "reduction generale but CTP is 801P then it should be positive, as we have to give money back
if category == '018' and 'base_amount/payroll/l10n/fr/ctp/801P' not in movement.getBaseContributionList():
assert quantity <= 0., "Quantity in %s should be negative" % movement.absolute_url() assert quantity <= 0., "Quantity in %s should be negative" % movement.absolute_url()
base = movement.base elif category == '018':
assert quantity >= 0., "Quantity in %s should be positive" % movement.absolute_url()
base = movement.base
elif category in ('059',):
quantity = (getattr(movement, 'employer_total_price', 0) + getattr(movement, 'employee_total_price', 0)) * -1
base = 0.
else: else:
base = movement.base base = movement.base
return { return {
......
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