add deductions renta

This commit is contained in:
wilson gomez sanchez 2021-03-22 16:14:14 -05:00
parent 98390f8041
commit 173de783e3
5 changed files with 175 additions and 15 deletions

View File

@ -57,7 +57,21 @@ class Employee(metaclass=PoolMeta):
'get_party_concept')
party_bank = fields.Function(fields.Many2One('party.party', 'Party Bank'),
'get_party_bank')
withholding_tax_deductible = fields.Numeric('Withholding Tax Deductible', digits=(16, 2))
fvp_ind = fields.Numeric('Voluntary Pension Fund Individual', digits=(16, 2),
help='Voluntary Pension Fund Individual Savings Contribution Art. 55')
fvp = fields.Numeric('Voluntary Pension Fund', digits=(16, 2),
help='Voluntary Pension Fund Contribution (FVP) Art. 126')
afc = fields.Numeric('Savings For the Promotion of Construction', digits=(16, 2),
help='Savings for the promotion of construction (AFC)')
housing_interest = fields.Numeric('Housing Interest', digits=(16, 2),
help='Housing Interest (average for the previous year or corresponding months)')
health_prepaid = fields.Numeric('Prepaid Medicine', digits=(16, 2),
help='Health Payments Prepaid Medicine')
dependents = fields.Numeric('Dependents', digits=(16, 2),
help='''The taxpayer's children up to 18 years of age or education 18 - 23 years of age.
Economic dependency spouse, parents, siblings or children supported.''')
other_income = fields.Numeric('Other Income', digits=(16, 2),
help='Other Income')
@classmethod
def __setup__(cls):

View File

@ -543,7 +543,7 @@ class Liquidation(Workflow, ModelSQL, ModelView):
# Add days for months in given date
for i in range(0, start_date.month - 1):
n1 += 30
# Since every leap year is of 366 days,
# Since every leap year is of 360 days,
# Add a day for every leap year
n1 += self.countLeapYears(start_date)
# SIMILARLY, COUNT TOTAL NUMBER OF DAYS BEFORE 'dt2'
@ -552,7 +552,6 @@ class Liquidation(Workflow, ModelSQL, ModelView):
n2 += 30
n2 += self.countLeapYears(end_date)
# return difference between two counts
print(n2-n1+1, 'dias')
return (n2 - n1+1)
# def get_time_contracting(self, start_date, end_date):

View File

@ -82,6 +82,34 @@ msgctxt "error:staff_payroll_co.payroll_by_period_dynamic:"
msgid "The period overlap another period!"
msgstr "El periodo se cruza con otro periodo."
msgctxt "field:company.employee,afc:"
msgid "Savings For the Promotion of Construction"
msgstr "Ahorro para el fomento de la construcción"
msgctxt "field:company.employee,dependents:"
msgid "Dependents"
msgstr "Dependientes"
msgctxt "field:company.employee,fvp:"
msgid "Voluntary Pension Fund"
msgstr "Fondo de Pension Voluntaria"
msgctxt "field:company.employee,fvp_ind:"
msgid "Voluntary Pension Fund Individual"
msgstr "Fondo de Pension Voluntaria Individual"
msgctxt "field:company.employee,health_prepaid:"
msgid "Prepaid Medicine"
msgstr "Medicina Prepagada"
msgctxt "field:company.employee,housing_interest:"
msgid "Housing Interest"
msgstr "Interes de Vivienda"
msgctxt "field:company.employee,other_income:"
msgid "Other Income"
msgstr "Otras Rentas Exentas"
msgctxt "field:company.employee,party_bank:"
msgid "Party Bank"
msgstr "Banco"
@ -102,10 +130,6 @@ msgctxt "field:company.employee,party_risk:"
msgid "Party Risk"
msgstr "ARL"
msgctxt "field:company.employee,withholding_tax_deductible:"
msgid "Withholding Tax Deductible"
msgstr "Base de Retención Fiscal Deducible"
msgctxt "field:staff.configuration,extras_limit:"
msgid "Extras Limit"
msgstr "Límite de Horas Extras"
@ -466,9 +490,10 @@ msgctxt "field:staff.liquidation_export.start,end_date:"
msgid "End Date"
msgstr "Fin"
#, fuzzy
msgctxt "field:staff.liquidation_export.start,id:"
msgid "ID"
msgstr ""
msgstr "UP"
msgctxt "field:staff.liquidation_export.start,kind:"
msgid "Kind"
@ -972,6 +997,41 @@ msgctxt "field:staff_payroll_co.payroll_by_period_dynamic,write_uid:"
msgid "Write User"
msgstr "Modificado por Usuario"
msgctxt "help:company.employee,afc:"
msgid "Savings for the promotion of construction (AFC)"
msgstr "Ahorro para el fomento de la construcción (AFC)"
msgctxt "help:company.employee,dependents:"
msgid ""
"The taxpayer's children up to 18 years of age or education 18 - 23 years of age.\n"
" Economic dependency spouse, parents, siblings or children supported."
msgstr ""
"Los hijos del contribuyente hasta los 18 años de edad o por educación 18 - 23 años de edad.\n"
"Dependencia económica cónyuge, padres, hermanos o hijos."
msgctxt "help:company.employee,fvp:"
msgid "Voluntary Pension Fund Contribution (FVP) Art. 126"
msgstr "Contribución voluntaria al fondo de pensiones (FVP) Art. 126"
msgctxt "help:company.employee,fvp_ind:"
msgid "Voluntary Pension Fund Individual Savings Contribution Art. 55"
msgstr "Fondo de Ahorro Pensiones Voluntario Cotización Individual Art. 55"
msgctxt "help:company.employee,health_prepaid:"
msgid "Health Payments Prepaid Medicine"
msgstr "Salud Pagos Medicina Prepagada"
msgctxt "help:company.employee,housing_interest:"
msgid ""
"Housing Interest (average for the previous year or corresponding months)"
msgstr ""
"Interés de vivienda (promedio del año anterior o de los meses "
"correspondientes)"
msgctxt "help:company.employee,other_income:"
msgid "Other Income"
msgstr "Otras Rentas Exentas"
msgctxt "help:staff.configuration,extras_limit:"
msgid "In hours"
msgstr "En horas"
@ -1544,6 +1604,10 @@ msgctxt "selection:staff_payroll_co.payroll_by_period_dynamic,state:"
msgid "Open"
msgstr "Abrir"
msgctxt "view:company.employee:"
msgid "Withholding Tax Deductible"
msgstr "Base de Retención Fiscal Deducible"
msgctxt "view:staff.liquidation.line:"
msgid "Adjustments"
msgstr "Ajustes"

View File

@ -43,6 +43,22 @@ PAYMENTS = [
SOCIAL_SEGURITY = [
'risk', 'health', 'retirement', 'box_family', 'sena', 'icbf'
]
LIM_UVT_DEDUCTIBLE = {
'fvp_ind': 2500,
'afc_fvp': (3800/12),
'housing_interest': 100,
'health_prepaid': 16,
'dependents': 32,
'exempted_incom': 240
}
LIM_PERCENT_DEDUCTIBLE = {
'fvp_ind': 25,
'dependents': 10,
'afc_fvp': 30,
'exempted_income': 25,
'renta_deductions': 40
}
ENTITY_ACCOUNTS = {
'830113831': (23700501, 72056901),
@ -562,10 +578,30 @@ class Payroll(metaclass=PoolMeta):
'unit_value': unit_value, 'quantity': 1
})
def check_limit(self, base, field, value_field):
Configuration = Pool().get('staff.configuration')
configuration = Configuration(1)
if not configuration.uvt_value:
return 0
uvt_config = configuration.uvt_value
lim_percent = LIM_PERCENT_DEDUCTIBLE[field] if field in LIM_PERCENT_DEDUCTIBLE.keys() else None
lim_uvt = LIM_UVT_DEDUCTIBLE[field] if field in LIM_UVT_DEDUCTIBLE.keys() else None
res = value_field
if lim_uvt:
value_limit_uvt = uvt_config * lim_uvt
if value_field > value_limit_uvt:
res = value_limit_uvt
if lim_percent:
value_limit_percent = base * lim_percent / 100
if value_field > value_limit_percent:
res = value_limit_percent
return res
def _compute_line_tax(self, line_tax):
UvtWithholding = Pool().get('staff.payroll.uvt_withholding')
salary_full = self.get_salary_full(line_tax.wage_type)
deductions_month = self.get_deductions_month()
amount_tax = line_tax.amount if line_tax.amount else 0
deductions_month = self.get_deductions_month() - amount_tax
salary_full = salary_full['salary']
if self.last_payroll:
payrolls_ids = self._get_payrolls_contract()
@ -580,7 +616,40 @@ class Payroll(metaclass=PoolMeta):
# holidays_ids
# )
# salary_full += hoard_holidays
base_salary_withholding = salary_full - deductions_month
deductions_fields = ['fvp_ind', 'health_prepaid', 'fvp', 'afc', 'other_income', 'housing_interest', 'dependents']
deductions_values = {
'fvp_ind': 0,
'health_prepaid': 0,
'fvp_afc': 0,
'other_income': 0,
'housing_interest': 0,
'dependents': 0
}
for field in deductions_fields:
value = getattr(self.employee, field) if getattr(self.employee, field) else 0
if field not in ('fvp', 'afc'):
deductions_values[field] = value
elif field in ('fvp', 'afc'):
deductions_values['fvp_afc'] += value
value = 0
for k, v in deductions_values.items():
res = self.check_limit(salary_full, k, v)
deductions_values[k] = res
base_salary_withholding = salary_full - deductions_month - deductions_values['fvp_ind']
deductions_values.pop('fvp_ind')
deductions_renta = sum(v for v in deductions_values.values())
lim_rete_deductions = base_salary_withholding * LIM_PERCENT_DEDUCTIBLE['renta_deductions'] /100
if deductions_renta >= lim_rete_deductions:
deductions_renta = lim_rete_deductions
base_c = base_salary_withholding - deductions_renta
renta25c = self.check_limit(None, 'exempte_income', base_c * LIM_PERCENT_DEDUCTIBLE['exempted_income']/100)
deductions_renta_renta25c = deductions_renta + renta25c
if deductions_renta_renta25c > lim_rete_deductions:
deductions_renta_renta25c = lim_rete_deductions
base_salary_withholding -= deductions_renta
unit_value = UvtWithholding.compute_withholding(
base_salary_withholding)
unit_value = self.currency.round(Decimal(unit_value))

View File

@ -2,9 +2,23 @@
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
this repository contains the full copyright notices and license terms. -->
<data>
<xpath
expr="/form/notebook/page[@id='info']/field[@name='contracting_state']" position="after">
<label name="withholding_tax_deductible"/>
<field name="withholding_tax_deductible"/>
</xpath>
<xpath
expr="/form/notebook/page[@id='mandatory_wages']" position="after">
<page string="Withholding Tax Deductible" id="withholding_tax_deductible">
<label name="health_prepaid"/>
<field name="health_prepaid"/>
<label name="fvp_ind"/>
<field name="fvp_ind"/>
<label name="fvp"/>
<field name="fvp"/>
<label name="afc"/>
<field name="afc"/>
<label name="housing_interest"/>
<field name="housing_interest"/>
<label name="dependents"/>
<field name="dependents"/>
<label name="other_income"/>
<field name="other_income"/>
</page>
</xpath>
</data>