Skip to content
This repository has been archived by the owner on Jul 17, 2024. It is now read-only.

Commit

Permalink
[FIX] Ausencias
Browse files Browse the repository at this point in the history
Para Licencias son trabaja días continuos
  • Loading branch information
Nelson Ramírez Sánchez committed Dec 10, 2018
1 parent 4486c59 commit 2c87a5c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 14 deletions.
4 changes: 1 addition & 3 deletions l10n_cl_hr/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"Francisco Lorca <fcolorca1979@gmail.com>",
],
'license': 'AGPL-3',
'version': '11.0.1.2.9',
'version': '11.0.1.3.0',
'description': """
Chilean Payroll & Human Resources.
==================================
Expand All @@ -52,13 +52,11 @@
'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',
'views/hr_holiday_views.xml',
'views/wizard_export_csv_previred_view.xml',
#'views/account_centralized_export.xml',
'data/hr_salary_rule_category.xml',
'data/l10n_cl_hr_indicadores.xml',
'data/l10n_cl_hr_isapre.xml',
Expand Down
25 changes: 14 additions & 11 deletions l10n_cl_hr/model/hr_holidays.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ class HRHolidaysStatus(models.Model):
is_continued = fields.Boolean('Disccount Weekends')



class HRHolidays(models.Model):
_inherit = 'hr.holidays'

Expand All @@ -22,7 +21,7 @@ def _get_number_of_days(self, date_from, date_to, employee_id):
from_dt = fields.Datetime.from_string(date_from)
to_dt = fields.Datetime.from_string(date_to)

#En el caso de las licencias descontamos dias corridos
#Función Original: Agregamos la opción de días contínuos para licencias dias corridos
if employee_id and self.holiday_status_id.is_continued:
time_delta = to_dt - from_dt
return math.ceil(time_delta.days + float(time_delta.seconds) / 86400)
Expand All @@ -33,13 +32,20 @@ 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()
#Función Original: Agregamos el recálculo al cambiar holiday_status_id
@api.multi
@api.depends('number_of_days_temp', 'type', 'holiday_status_id')
def _compute_number_of_days(self):
for holiday in self:
if holiday.type == 'remove':
holiday.number_of_days = -holiday.number_of_days_temp
else:
holiday.number_of_days = holiday.number_of_days_temp




#Función Original: Agregamos el recálculo al cambiar holiday_status_id
@api.onchange('date_from','holiday_status_id','employee_id')
def _onchange_date_from(self):
""" If there are no date set for date_to, automatically set one 8 hours later than
Expand All @@ -59,6 +65,8 @@ def _onchange_date_from(self):
else:
self.number_of_days_temp = 0


#Función Original: Agregamos el recálculo al cambiar holiday_status_id
@api.onchange('date_to','holiday_status_id','employee_id')
def _onchange_date_to(self):
""" Update the number_of_days. """
Expand All @@ -69,9 +77,4 @@ def _onchange_date_to(self):
if (date_to and date_from) and (date_from <= date_to):
self.number_of_days_temp = self._get_number_of_days(date_from, date_to, self.employee_id.id)
else:
self.number_of_days_temp = 0

####################################################
# ORM Overrides methods
####################################################

self.number_of_days_temp = 0

0 comments on commit 2c87a5c

Please sign in to comment.