diff --git a/addons/hr_holidays/hr_holidays.py b/addons/hr_holidays/hr_holidays.py
index 3bb7a8e4982..37d51bbef9c 100644
--- a/addons/hr_holidays/hr_holidays.py
+++ b/addons/hr_holidays/hr_holidays.py
@@ -118,8 +118,8 @@ class hr_holidays(osv.osv):
\nThe state is \'Refused\', when holiday request is refused by manager.\
\nThe state is \'Approved\', when holiday request is approved by manager.'),
'user_id':fields.related('employee_id', 'user_id', type='many2one', relation='res.users', string='User', store=True),
- 'date_from': fields.datetime('Start Date', readonly=True, states={'draft':[('readonly',False)]}, select=True),
- 'date_to': fields.datetime('End Date', readonly=True, states={'draft':[('readonly',False)]}),
+ 'date_from': fields.date('Start Date', readonly=True, states={'draft':[('readonly',False)]}, select=True),
+ 'date_to': fields.date('End Date', readonly=True, states={'draft':[('readonly',False)]}),
'holiday_status_id': fields.many2one("hr.holidays.status", "Leave Type", required=True,readonly=True, states={'draft':[('readonly',False)]}),
'employee_id': fields.many2one('hr.employee', "Employee", select=True, invisible=False, readonly=True, states={'draft':[('readonly',False)]}, help='Leave Manager can let this field empty if this leave request/allocation is for every employee'),
#'manager_id': fields.many2one('hr.employee', 'Leave Manager', invisible=False, readonly=True, help='This area is automatically filled by the user who validate the leave'),
@@ -186,11 +186,11 @@ class hr_holidays(osv.osv):
def _get_number_of_days(self, date_from, date_to):
"""Returns a float equals to the timedelta between two dates given as string."""
- DATETIME_FORMAT = "%Y-%m-%d %H:%M:%S"
+ DATETIME_FORMAT = "%Y-%m-%d"
from_dt = datetime.datetime.strptime(date_from, DATETIME_FORMAT)
to_dt = datetime.datetime.strptime(date_to, DATETIME_FORMAT)
timedelta = to_dt - from_dt
- diff_day = timedelta.days + float(timedelta.seconds) / 86400
+ diff_day = timedelta.days
return diff_day
def unlink(self, cr, uid, ids, context=None):
@@ -413,8 +413,8 @@ class hr_employee(osv.osv):
def _get_leave_status(self, cr, uid, ids, name, args, context=None):
holidays_id = self.pool.get('hr.holidays').search(cr, uid,
- [('employee_id', 'in', ids), ('date_from','<=',time.strftime('%Y-%m-%d %H:%M:%S')),
- ('date_to','>=',time.strftime('%Y-%m-%d %H:%M:%S')),('type','=','remove'),('state','not in',('cancel','refuse'))],
+ [('employee_id', 'in', ids), ('date_from','<=',time.strftime('%Y-%m-%d')),
+ ('date_to','>=',time.strftime('%Y-%m-%d')),('type','=','remove'),('state','not in',('cancel','refuse'))],
context=context)
result = {}
for id in ids:
diff --git a/addons/hr_holidays/hr_holidays_view.xml b/addons/hr_holidays/hr_holidays_view.xml
index c01bfe99ad3..f74ca860ec6 100644
--- a/addons/hr_holidays/hr_holidays_view.xml
+++ b/addons/hr_holidays/hr_holidays_view.xml
@@ -51,6 +51,7 @@
calendar
+
@@ -86,9 +87,8 @@
-
-
-
+
+
@@ -129,9 +129,8 @@
-
-
-
+
+
@@ -258,7 +257,7 @@
hr.holidays
form
- {"search_default_department_id": department_id, "search_default_my_leaves": 1}
+ {"search_default_department_id": department_id}
[('type','=','remove')]
Leave requests can be recorded by employees and validated by their managers. Once a leave request is validated, it appears automatically in the agenda of the employee. You can define several allowance types (paid holidays, sickness, etc.) and manage allowances per type.
diff --git a/addons/hr_holidays/test/test_hr_holiday.yml b/addons/hr_holidays/test/test_hr_holiday.yml
index 9228a7a381e..92497742058 100644
--- a/addons/hr_holidays/test/test_hr_holiday.yml
+++ b/addons/hr_holidays/test/test_hr_holiday.yml
@@ -6,8 +6,8 @@
!record {model: hr.holidays, id: hr_holiday1}:
name: Sick Leave
holiday_status_id: holiday_status_cl
- date_from: !eval time.strftime('%Y-%m-10 10:00:00')
- date_to: !eval time.strftime('%Y-%m-11 19:00:00')
+ date_from: !eval time.strftime('%Y-%m-10')
+ date_to: !eval time.strftime('%Y-%m-11')
employee_id: hr.employee_fp
type: remove
-