diff --git a/hr_holidays_usability/README.rst b/hr_holidays_usability/README.rst index 52ffaad..171b99c 100644 --- a/hr_holidays_usability/README.rst +++ b/hr_holidays_usability/README.rst @@ -9,6 +9,22 @@ This module adds what I consider the minimum usability level for the holiday man * It sends an email to the manager when the employee submits a holiday requests (with the employee in Cc) and it sends an email to the employee (with the manager in Cc) when the holiday request is validated/refused. +Installation +============ + +This module requires a patch on the official hr_holidays module: +in addons/hr_holidays/hr_holidays.py, in the method holidays_validate(), remplace + +.. code:: + + if record.holiday_type == 'employee' and record.type == 'remove': + +by + +.. code:: + + if record.holiday_type == 'employee' and record.type == 'remove' and record.date_from and record.date_to: + Known issues / Roadmap ====================== diff --git a/hr_holidays_usability/hr_holidays.py b/hr_holidays_usability/hr_holidays.py index 7134770..db1022e 100644 --- a/hr_holidays_usability/hr_holidays.py +++ b/hr_holidays_usability/hr_holidays.py @@ -78,7 +78,7 @@ class HrHolidays(orm.Model): hhpo = self.pool['hr.holidays.public'] for hol in self.browse(cr, uid, ids, context=context): days = 0.0 - if hol.type == 'remove' and hol.holiday_type == 'employee': + if hol.type == 'remove' and hol.holiday_type == 'employee' and hol.vacation_date_from and hol.vacation_date_to: if hol.holiday_status_id.vacation_compute_method == 'business': business = True else: @@ -136,13 +136,17 @@ class HrHolidays(orm.Model): days -= 0.5 break date_dt += relativedelta(days=1) - - if hol.type == 'remove': - # read number_of_days_remove instead of number_of_days_temp res[hol.id] = { 'number_of_days': days * -1, 'number_of_days_remove': days, } + + elif hol.type == 'remove': + # When we do a leave and force qty + res[hol.id] = { + 'number_of_days': hol.number_of_days_temp * -1, + 'number_of_days_remove': hol.number_of_days_temp, + } else: # for allocations, we read the native field number_of_days_temp res[hol.id] = { @@ -231,7 +235,7 @@ class HrHolidays(orm.Model): def _check_vacation_dates(self, cr, uid, ids): hhpo = self.pool['hr.holidays.public'] for hol in self.browse(cr, uid, ids): - if hol.type == 'remove': + if hol.type == 'remove' and hol.vacation_date_from and hol.vacation_date_to: if hol.vacation_date_from > hol.vacation_date_to: raise orm.except_orm( _('Error:'), diff --git a/hr_holidays_usability/hr_holidays_view.xml b/hr_holidays_usability/hr_holidays_view.xml index 426f99b..36f7dbc 100644 --- a/hr_holidays_usability/hr_holidays_view.xml +++ b/hr_holidays_usability/hr_holidays_view.xml @@ -132,9 +132,65 @@ mrp.access_resource_calendar_leaves_user,only read access to manufacuting user,r --> + + + + Leave request force qty + hr.holidays + +
+
+
+ + + + + + + + + + + + + + + +
+ + +
+
+
+
+ + + Leave Requests Force Qty + hr.holidays + form + + {'default_type': 'remove'} + [('type','=','remove')] + + + + + parent="hr_holidays.menu_open_ask_holidays" sequence="50"/> diff --git a/hr_holidays_usability/report/hr_holidays_employee_counter_view.xml b/hr_holidays_usability/report/hr_holidays_employee_counter_view.xml index 84ab852..a309267 100644 --- a/hr_holidays_usability/report/hr_holidays_employee_counter_view.xml +++ b/hr_holidays_usability/report/hr_holidays_employee_counter_view.xml @@ -44,7 +44,8 @@ + parent="hr_holidays.menu_open_ask_holidays" + sequence="30"/> diff --git a/hr_holidays_usability/wizard/hr_holidays_mass_allocation_view.xml b/hr_holidays_usability/wizard/hr_holidays_mass_allocation_view.xml index b92af37..b2c6bf1 100644 --- a/hr_holidays_usability/wizard/hr_holidays_mass_allocation_view.xml +++ b/hr_holidays_usability/wizard/hr_holidays_mass_allocation_view.xml @@ -39,7 +39,7 @@ + groups="base.group_hr_user" sequence="20"/> diff --git a/hr_holidays_usability/wizard/hr_holidays_post_view.xml b/hr_holidays_usability/wizard/hr_holidays_post_view.xml index eebfe24..8cb9b19 100644 --- a/hr_holidays_usability/wizard/hr_holidays_post_view.xml +++ b/hr_holidays_usability/wizard/hr_holidays_post_view.xml @@ -41,7 +41,7 @@ + groups="base.group_hr_user" sequence="30"/>