Commit a547aa13 authored by Nicolas Wavrant's avatar Nicolas Wavrant

erp5_payroll_l10n_fr: compute blocks for annual taxes

parent 1c8ddad7
......@@ -294,6 +294,10 @@ if block_id == 'S21.G00.40':
rubric_value_dict["S21.G00.40.042"] = ''
rubric_value_dict["S21.G00.40.043"] = formatFloat(enrollment_record.getOccupationalAccidentRiskRate())
# Assujettissement fiscal
if block_id == 'S21.G00.44':
rubric_value_dict['S21.G00.44.001'] = kw['tax_code']
rubric_value_dict['S21.G00.44.002'] = formatFloat(kw['amount'])
# Versement Individu
if block_id == 'S21.G00.50':
......
......@@ -192,8 +192,14 @@ else:
dsn_file.append(getDSNBlockDict(block_id='S21.G00.23',
target=aggregated_social_contribution_dict[ctp_code]))
dsn_file.append(getDSNBlockDict(block_id='S21.G00.42', target=establishment))
dsn_file.append(getDSNBlockDict(block_id='S21.G00.44', target=establishment))
# Annual Taxes
if organisation == establishment:
tax_list = organisation.Organisation_getAnnualTaxDictList(context)
for tax in tax_list:
if tax['tax_code'] == '011':
dsn_file.append(getDSNBlockDict(block_id='S21.G00.42', target=establishment))
dsn_file.append(getDSNBlockDict(block_id='S21.G00.44', target=establishment, **tax))
for employee_data_dict, paysheet_data_dict in employee_result_list:
enrollment_record = employee_data_dict['enrollment_record']
......
portal = context.getPortalObject()
# Annual taxes are only to declare in May or December
current_month = dsn_report.getEffectiveDate().month()
if current_month not in (5, 12):
return []
annual_tax_list = []
tax_property_name_list = {
'apprenticeship_fee_liability': ('001', '002'),
'apprenticeship_supplementary_fee_liability': ('003', '004'),
'construction_effort_fee_liability': ('005', '006'),
'continuous_professional_training_fee_liability': ('007', '008'),
'salary_fee_liability': ('009', '010'),
'cvae_fee_liability': ('011', '012'),
'continuous_short_term_professional_training_fee_liability': ('013', '014'),
}
if dsn_report.getEffectiveDate().month() == 5:
tax = 'cvae_fee_liability'
result = {
'tax_code': '',
'amount': 0., # TODO: get amount right
}
if context.getProperty(tax, False):
result['tax_code'] = tax_property_name_list['cvae_fee_liability'][0]
else:
result['tax_code'] = tax_property_name_list['cvae_fee_liability'][1]
return result
year_start_date = DateTime(dsn_report.getEffectiveDate().year(), 1, 1)
year_stop_date = DateTime(dsn_report.getEffectiveDate().year(), 12, 31)
for tax, value_list in tax_property_name_list.items():
is_subjected = context.getProperty(tax, False)
amount = 0.
if is_subjected:
amount = portal.portal_simulation.getInventory(
node_uid=portal.account_module.remuneration_personnel.getUid(), # XXX: hardcoded
from_date=year_start_date,
at_date=year_stop_date,
section_uid=context.getUid(),
portal_type="Accounting Transaction Line",
simulation_state=['stopped', 'delivered', 'started', 'confirmed'],
)
annual_tax_list.append({
'tax_code': (value_list[0] if is_subjected else value_list[1]),
'amount': amount,
})
return annual_tax_list
# TODO : calculate base values for salary fee in case the company is subjected
# (for codes 015, 016 and 017 of S21.G00.44.001)
<?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>_params</string> </key>
<value> <string>dsn_report=None</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Organisation_getAnnualTaxDictList</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
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