From fabf4971aaaebb03d3bc7c582b5acb68082c0a2c Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Mon, 17 Sep 2012 10:14:51 +0200 Subject: [PATCH] [FIX] timesheet_sheet should not crash anymmore when tests are performed at 23:59 bzr revid: fp@tinyerp.com-20120917081451-ugk1qi0le22kn44n --- addons/hr_attendance/hr_attendance.py | 2 +- .../test/test_hr_timesheet_sheet.yml | 26 +++++++++++-------- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/addons/hr_attendance/hr_attendance.py b/addons/hr_attendance/hr_attendance.py index d3bc79bda1a..8fdd2928fe6 100644 --- a/addons/hr_attendance/hr_attendance.py +++ b/addons/hr_attendance/hr_attendance.py @@ -55,7 +55,7 @@ class hr_attendance(osv.osv): 'name': fields.datetime('Date', required=True, select=1), 'action': fields.selection([('sign_in', 'Sign In'), ('sign_out', 'Sign Out'), ('action','Action')], 'Action', required=True), 'action_desc': fields.many2one("hr.action.reason", "Action Reason", domain="[('action_type', '=', action)]", help='Specifies the reason for Signing In/Signing Out in case of extra hours.'), - 'employee_id': fields.many2one('hr.employee', "Employee's Name", required=True, select=True), + 'employee_id': fields.many2one('hr.employee', "Employee", required=True, select=True), 'day': fields.function(_day_compute, type='char', string='Day', store=True, select=1, size=32), } _defaults = { diff --git a/addons/hr_timesheet_sheet/test/test_hr_timesheet_sheet.yml b/addons/hr_timesheet_sheet/test/test_hr_timesheet_sheet.yml index 99705b07a39..070079a4b80 100644 --- a/addons/hr_timesheet_sheet/test/test_hr_timesheet_sheet.yml +++ b/addons/hr_timesheet_sheet/test/test_hr_timesheet_sheet.yml @@ -13,7 +13,7 @@ product_id: product.product_product_consultant journal_id: hr_timesheet.analytic_journal - - I create my current timesheet for employee "Quentin Paolinon". + I create a timesheet for employee "Quentin Paolinon". - !record {model: hr_timesheet_sheet.sheet, id: hr_timesheet_sheet_sheet_deddk0}: date_current: !eval time.strftime('%Y-%m-%d') @@ -23,13 +23,17 @@ user_id: base.user_demo employee_id: 'hr.employee_qdp' - - Now, at the time of login, I create Attendances and perform "Sign In" action. + Quentin "Sign In" at around 9am. - - !python {model: hr_timesheet_sheet.sheet}: | - self.attendance_action_change(cr, uid, [ref('hr_timesheet_sheet_sheet_deddk0')], {}) - task_work = self.search(cr, uid, [("name","=","Quentin Paolinon")],context)[0] - task_ids = self.browse(cr, uid, task_work, context) - assert task_ids.state == "draft", "I State In Timesheet" + !record {model: hr.attendance, id: hr_attendance_1}: + action: sign_in + employee_id: 'hr.employee_qdp' + name: !eval datetime.now().strftime('%Y-%m-%d 09:%M:%S') +- + I test that Quentin in signed in +- + !assert {model: hr.employee, id: hr.employee_qdp}: + - state == 'present' - I want to check attendance and work of yesterday. I click on <- button. - @@ -57,10 +61,10 @@ - At the time of logout, I create attendance and perform "Sign Out". - - !record {model: hr.attendance, id: hr_attendance_1}: + !record {model: hr.attendance, id: hr_attendance_2}: action: sign_out employee_id: 'hr.employee_qdp' - name: !eval (datetime.now() + timedelta(minutes=1)).strftime('%Y-%m-%d %H:%M:%S') + name: !eval datetime.now().strftime('%Y-%m-%d 17:30:00') - I create Timesheet Entry for time spend on today work. - @@ -103,10 +107,10 @@ general_account_id: account.a_expense journal_id: hr_timesheet.analytic_journal - - I set an allowed difference of 25 hours + I set an allowed difference of 1 hour - !record {model: res.company, id: base.main_company}: - timesheet_max_difference: 25.00 + timesheet_max_difference: 1.00 - I tried again to confirm the timesheet after modification. -