Skip to content

Commit

Permalink
[IMP] Many Improvements
Browse files Browse the repository at this point in the history
[ADD] Crear Libro de Remuneraciones
[ADD] IPC
[ADD] Anticipo de Sueldo Input
[FIX] Tributable en AFC
[ADD] Totales en Libro de Remuneraciones
[FIX] Seguridad
[IMP] RUT Warnings
[ADD] Decimal Precision
  • Loading branch information
Nelson Ramírez Sánchez committed Jun 15, 2018
1 parent 0cbac6f commit 6c95b98
Show file tree
Hide file tree
Showing 22 changed files with 927 additions and 39 deletions.
674 changes: 674 additions & 0 deletions l10n_cl_hr/LICENSE

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions l10n_cl_hr/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ https://www.youtube.com/watch?v=raLA72Sfcds

## Credits
<p>
<img width="200" alt="Logo Konos" src="http://www.konos.cl/web/image/666" />
<img width="200" alt="Logo Konos" src="http://www.konos.cl/web/image/1149" />
</p>
**Konos** - http://konos.cl
- Nelson Ramírez <info@konos.cl>
Expand Down Expand Up @@ -36,6 +36,7 @@ https://www.youtube.com/watch?v=raLA72Sfcds
- Carlos Lopez Mite <celm1990@hotmail.com>
- Daniel Santibáñez Polanco <dsantibanez@globalresponse.cl>
- Francisco Lorca <fcolorca1979@gmail.com>
- Marcel Rodriguez <jmrv1981@hotmail.com>



Expand All @@ -52,7 +53,7 @@ https://www.youtube.com/watch?v=raLA72Sfcds

## Créditos
<p>
<img width="200" alt="Logo Konos" src="http://www.konos.cl/web/image/666" />
<img width="200" alt="Logo Konos" src="http://www.konos.cl/web/image/1149" />
</p>
**Konos** - http://konos.cl
- Nelson Ramírez <info@konos.cl>
Expand Down Expand Up @@ -81,3 +82,4 @@ https://www.youtube.com/watch?v=raLA72Sfcds
- Carlos Lopez Mite <celm1990@hotmail.com>
- Daniel Santibáñez Polanco <dsantibanez@globalresponse.cl>
- Francisco Lorca <fcolorca1979@gmail.com>
- Marcel Rodriguez <jmrv1981@hotmail.com>
5 changes: 3 additions & 2 deletions l10n_cl_hr/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@
"Carlos Lopez Mite <celm1990@hotmail.com>",
"Daniel Santibáñez Polanco <dsantibanez@globalresponse.cl>",
"Francisco Lorca <fcolorca1979@gmail.com>",
"Marcel Rodriguez <jmrv1981@hotmail.com>",
],
'license': 'AGPL-3',
'version': '11.0.1.0.12',
'version': '11.0.1.2.0',
'description': """
Chilean Payroll & Human Resources.
==================================
Expand All @@ -52,7 +53,6 @@
'views/hr_payslip_view.xml',
'views/hr_afp_view.xml',
'views/hr_payslip_run_view.xml',
'views/hr_contribution_register_view.xml',
'views/report_payslip.xml',
'views/report_hrsalarybymonth.xml',
'views/hr_salary_books.xml',
Expand All @@ -67,6 +67,7 @@
'data/resource_calendar_attendance.xml',
'data/hr_holidays_status.xml',
'data/hr_contract_type.xml',
'data/account_journal.xml',
'security/ir.model.access.csv',
],
'demo': ['demo/l10n_cl_hr_payroll_demo.xml'],
Expand Down
17 changes: 17 additions & 0 deletions l10n_cl_hr/data/account_journal.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>

<!--
Account Journal
-->
<record id="payroll_journal" model="account.journal">
<field name="name">Libro de Remuneraciones</field>
<field name="code">REMU</field>
<field name="type">general</field>
<field name="show_on_dashboard" eval="True"/>
</record>


</data>
</odoo>
1 change: 1 addition & 0 deletions l10n_cl_hr/data/l10n_cl_hr_indicadores.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
<field name="tasa_independiente_modelo">12.18</field>
<field name="tope_anual_apv">600</field>
<field name="tope_mensual_apv">50</field>
<field name="ipc">0</field>
</record>
</data>
</odoo>
17 changes: 15 additions & 2 deletions l10n_cl_hr/data/l10n_cl_hr_payroll_data.xml
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,8 @@ else:

if contract.pension is True:
result = 0
elif contract.sin_afp is True:
result = 0
elif TOTIM >=round(payslip.indicadores_id.tope_imponible_afp*payslip.indicadores_id.uf):
result =round( round(payslip.indicadores_id.tope_imponible_afp*payslip.indicadores_id.uf)*tasa /100)
else:
Expand Down Expand Up @@ -402,6 +404,8 @@ else:

if contract.pension is True:
result = 0
elif contract.sin_afp is True:
result = 0
elif TOTIM >=round(payslip.indicadores_id.tope_imponible_afp*payslip.indicadores_id.uf):
result = round(round(payslip.indicadores_id.tope_imponible_afp*payslip.indicadores_id.uf)*tasa /100)
elif TOTIM ==0:
Expand Down Expand Up @@ -617,9 +621,12 @@ else:
<field name="code">ASUE</field>
<field name="category_id" ref="ODESC"/>
<field name="condition_select">python</field>
<field name="condition_python">result = contract.anticipo_sueldo > 0</field>
<field name="condition_python">result = (contract.anticipo_sueldo > 0) or (inputs.ASUE.amount > 0)</field>
<field name="amount_select">code</field>
<field name="amount_python_compute">result = contract.anticipo_sueldo</field>
<field name="amount_python_compute">if (inputs.ASUE.amount > 0):
result = inputs.ASUE.amount
else:
result = contract.anticipo_sueldo</field>
</record>

<record id="hr_rule_38_1" model="hr.salary.rule">
Expand Down Expand Up @@ -776,6 +783,12 @@ result = round(SECEEMP) + round(SIS) + round(MUT) + round(SC)</field>
<field name="name">PRESTAMO CCAF</field>
<field name="input_id" ref="hr_rule_12"/>
</record>

<record id="hr_rule_input_anticipo_sueldo" model="hr.rule.input">
<field name="code">ASUE</field>
<field name="name">ANTICIPO DE SUELDO</field>
<field name="input_id" ref="hr_rule_38"/>
</record>
<!-- Estructura Inputs -->

<record id="hr_struct_cl" model="hr.payroll.structure">
Expand Down
4 changes: 3 additions & 1 deletion l10n_cl_hr/data/resource_calendar_attendance.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@
<field name="calendar_id" ref="hr_resource_monthly_cl"/>
</record>


<record id="base.main_company" model="res.company">
<field name="resource_calendar_id" ref="hr_resource_monthly_cl"/>
</record>


</data>
Expand Down
18 changes: 12 additions & 6 deletions l10n_cl_hr/demo/l10n_cl_hr_payroll_demo.xml
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>

<!-- Empleado Inputs -->
<record id="hr_employee_data_demo" model="hr.employee">
<field name="firstname">Nelson</field>
<field name="middle_name">Jorge</field>
<field name="name">Nelson</field>
<field name="last_name">Ramírez</field>
<field name="mothers_name">Sánchez</field>
<field name="identification_id">24625430-K</field>
</record>

Expand All @@ -25,7 +28,10 @@
<field name="afp_id" ref="hr_afp_modelo"/>
<field name="mutual_seguridad">TRUE</field>
<field name="struct_id" ref="hr_struct_cl"/>
<field name="working_hours" ref="hr_resource_monthly"/>
<field name="resource_calendar_id" ref="hr_resource_monthly_cl"/>
<field name="journal_id" ref="payroll_journal"/>
</record>
</data>
</odoo>
</data>
</odoo>


2 changes: 1 addition & 1 deletion l10n_cl_hr/i18n/es_CL.po
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ msgstr "Colación"
#. module: l10n_cl_hr
#: model:ir.model,name:l10n_cl_hr.model_hr_contract_type
msgid "Contract Type"
msgstr "Tipo de contrato"
msgstr "Tipo de Contrato"

#. module: l10n_cl_hr
#: selection:hr.payslip,movimientos_personal:0
Expand Down
3 changes: 2 additions & 1 deletion l10n_cl_hr/model/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,5 @@
from . import hr_ccaf
from . import hr_contract
from . import hr_seguro_complementario
from . import hr_holidays
from . import hr_holidays
from . import hr_apv
41 changes: 41 additions & 0 deletions l10n_cl_hr/model/hr_apv.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# -*- coding: utf-8 -*-
##############################################################################
# Odoo / OpenERP, Open Source Management Solution
# Copyright (c) 2018 Konos
# Nelson Ramírez Sánchez
# http://konos.cl
#
# Derivative from Odoo / OpenERP / Tiny SPRL
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# garantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################


from odoo import api, fields, models, tools, _


class hr_apv(models.Model):
_name = 'hr.apv'
_description = 'Institución Autorizada APV - APVC : Cias Seguros de Vida'
codigo = fields.Char('Codigo', required=True)
name = fields.Char('Nombre', required=True)
5 changes: 4 additions & 1 deletion l10n_cl_hr/model/hr_contract.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ class hr_contract(models.Model):
Fields are used in salary rule computation.
"""
afp_id = fields.Many2one('hr.afp', 'AFP')
aporte_voluntario = fields.Float('Ahorro Previsional Voluntario (APV)', help="Ahorro Previsional Voluntario (APV)")
anticipo_sueldo = fields.Float('Anticipo de Sueldo',help="Anticipo De Sueldo Realizado Contablemente")
carga_familiar = fields.Integer('Carga Simple',help="Carga familiar para el cálculo de asignación familiar simple")
carga_familiar_maternal = fields.Integer('Carga Maternal',help="Carga familiar para el cálculo de asignación familiar maternal")
Expand All @@ -57,12 +56,16 @@ class hr_contract(models.Model):
otro_no_imp = fields.Float('Otros No Imponible', help="Otros Haberes No Imponibles")
otros_imp = fields.Float('Otros Imponible', help="Otros Haberes Imponibles")
pension = fields.Boolean('Pensionado')
sin_afp = fields.Boolean('No Calcula AFP')
seguro_complementario_id = fields.Many2one('hr.seguro.complementario', 'Nombre')
seguro_complementario = fields.Float('Cotización', help="Seguro Complementario")
viatico_santiago = fields.Float('Asig. Viático', help="Asignación de Viático")
complete_name = fields.Char(related='employee_id.firstname')
last_name = fields.Char(related='employee_id.last_name')
gratificacion_legal = fields.Boolean('Gratificación L. Manual')
isapre_moneda= fields.Selection((('uf', 'UF'), ('clp', 'Pesos')), 'Tipo de Moneda', default="uf")
apv_id = fields.Many2one('hr.apv', 'Nombre')
aporte_voluntario = fields.Float('Ahorro Previsional Voluntario (APV)', help="Ahorro Previsional Voluntario (APV)")
aporte_voluntario_moneda= fields.Selection((('uf', 'UF'), ('clp', 'Pesos')), 'Tipo de Moneda', default="uf")
forma_pago_apv = fields.Selection((('1', 'Directa'), ('2', 'Indirecta')), 'Forma de Pago', default="1")
seguro_complementario_moneda= fields.Selection((('uf', 'UF'), ('clp', 'Pesos')), 'Tipo de Moneda', default="uf")
33 changes: 23 additions & 10 deletions l10n_cl_hr/model/hr_employee.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,32 @@ class HrEmployee(models.Model):
type_id = fields.Many2one('hr.type.employee', 'Tipo de Empleado')
formated_vat = fields.Char(translate=True, string='Printable VAT', store=True,help='Show formatted vat')


@api.model
def _get_computed_name(self, last_name, firstname, last_name2=None, middle_name=None):
names = list()
if firstname:
names.append(firstname)
if middle_name:
names.append(middle_name)
if last_name:
names.append(last_name)
if last_name2:
names.append(last_name2)

return " ".join(names)


@api.multi
@api.onchange('firstname', 'mothers_name', 'middle_name' , 'last_name')
def get_name(self):
for employee in self:
if employee.firstname and employee.last_name:
employee.name = u" ".join((p for p in (self.last_name, self.mothers_name, self.firstname, self.middle_name) if p))
employee.name = self._get_computed_name(
employee.last_name, employee.firstname, employee.mothers_name, employee.middle_name)




@api.model
def _get_computed_name(self, last_name, firstname):
"""Compute the 'name' field according to splitted data.
You can override this method to change the order of lastname and
firstname the computed name"""
return u" ".join((p for p in (last_name, mothers_name, firstname, middle_name) if p))

@api.onchange('identification_id')
def onchange_document(self):
Expand All @@ -46,11 +56,11 @@ def onchange_document(self):
identification_id[-1])

def check_identification_id_cl (self, identification_id):
_logger.info('Por Aqui no Pasa ni de Vaina')
body, vdig = '', ''
if len(identification_id) > 9:
identification_id = identification_id.replace('-','',1).replace('.','',2)
if len(identification_id) != 9:
raise UserError(u'El Rut no tiene formato')
return False
else:
body, vdig = identification_id[:-1], identification_id[-1].upper()
Expand All @@ -62,8 +72,10 @@ def check_identification_id_cl (self, identification_id):
if operar == vdig:
return True
else:
raise UserError(u'El Rut no tiene formato')
return False
except IndexError:
raise UserError(u'El Rut no tiene formato')
return False


Expand All @@ -78,8 +90,9 @@ def _rut_unique(self):
('id','!=', r.id),
])
if r.identification_id !="55.555.555-5" and employee:
raise UserError(_('El Rut debe ser único'))
raise UserError(u'El Rut debe ser único')
return False




7 changes: 4 additions & 3 deletions l10n_cl_hr/model/hr_holidays.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ def _get_number_of_days(self, date_from, date_to, employee_id):
return math.ceil(time_delta.days + float(time_delta.seconds) / 86400)


# @api.onchange('holiday_status_id')
# def _onchange_holiday_status_id(self):
# self._check_and_recompute_days()
@api.onchange('holiday_status_id')
def _onchange_holiday_status_id(self):
self._check_and_recompute_days()



Expand Down Expand Up @@ -74,3 +74,4 @@ def _onchange_date_to(self):
####################################################
# ORM Overrides methods
####################################################

3 changes: 2 additions & 1 deletion l10n_cl_hr/model/hr_indicadores_previsionales.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,8 @@ class hr_indicadores_previsionales(models.Model):
year = fields.Integer('Año', required=True, default=datetime.now().strftime('%Y'))
gratificacion_legal = fields.Boolean('Gratificación L. Manual')
mutual_seguridad_bool = fields.Boolean('Mutual Seguridad', default=True)

ipc = fields.Float(
'IPC', required=True, help="Indice de Precios al Consumidor (IPC)")


@api.multi
Expand Down
3 changes: 2 additions & 1 deletion l10n_cl_hr/security/ir.model.access.csv
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ access_hr_isapre,hr.isapre,model_hr_isapre,hr_payroll.group_hr_payroll_manager,1
access_hr_type_employee,hr.type.employee,model_hr_type_employee,hr_payroll.group_hr_payroll_manager,1,1,1,1
access_hr_mutual,hr.mutual,model_hr_mutual,hr_payroll.group_hr_payroll_manager,1,1,1,1
access_hr_ccaf,hr.ccaf,model_hr_ccaf,hr_payroll.group_hr_payroll_manager,1,1,1,1
access_hr_seguro_complementario,hr.seguro.complementario,model_hr_seguro_complementario,hr_payroll.group_hr_payroll_manager,1,1,1,1
access_hr_seguro_complementario,hr.seguro.complementario,model_hr_seguro_complementario,hr_payroll.group_hr_payroll_manager,1,1,1,1
access_hr_apv,hr.apv,model_hr_apv,hr_payroll.group_hr_payroll_manager,1,1,1,1
Binary file modified l10n_cl_hr/static/description/foto1.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 6c95b98

Please sign in to comment.