[MERGE] [FIX] hr_timesheet_sheet: set default date to now when computing date in user's timezone, courtesy of Yannick Vaucher (Camptocamp)

eg: the sign-in/sign-out button on the employee do not provide date yet (value defined in _defaults) and it would broke the computation

bzr revid: mat@openerp.com-20140430121458-9h8c8j7fw823qf27
This commit is contained in:
Martin Trigaux 2014-04-30 14:14:58 +02:00
commit 431ef5c552
1 changed files with 3 additions and 0 deletions

View File

@ -407,6 +407,9 @@ class hr_attendance(osv.osv):
employee = employee_obj.browse(cr, uid, employee_id, context=context)
tz = employee.user_id.partner_id.tz
if not date:
date = time.strftime(DEFAULT_SERVER_DATETIME_FORMAT)
att_tz = timezone(tz or 'utc')
attendance_dt = datetime.strptime(date, DEFAULT_SERVER_DATETIME_FORMAT)