From de0023a14f723f21edbd8a2d41d4a4b7e458392e Mon Sep 17 00:00:00 2001 From: "Atul Patel (OpenERP)" Date: Thu, 11 Oct 2012 18:04:41 +0530 Subject: [PATCH] [FIX]: Fix default user timesheetline problem bzr revid: atp@tinyerp.com-20121011123441-5zg1nm394d0b45ky --- addons/hr_timesheet/hr_timesheet.py | 4 ++-- addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/hr_timesheet/hr_timesheet.py b/addons/hr_timesheet/hr_timesheet.py index cd0f873ccfd..7934b8e5be1 100644 --- a/addons/hr_timesheet/hr_timesheet.py +++ b/addons/hr_timesheet/hr_timesheet.py @@ -136,7 +136,7 @@ class hr_analytic_timesheet(osv.osv): emp_obj = self.pool.get('hr.employee') if context is None: context = {} - emp_id = emp_obj.search(cr, uid, [('user_id', '=', context.get('user_id', uid))], context=context) + emp_id = emp_obj.search(cr, uid, [('user_id', '=', context.get('user_id', False) or uid)], context=context) if not emp_id : raise osv.except_osv(_('Warning!'), _('Please create an employee for this user, using the menu: Human Resources > Employees.')) emp = emp_obj.browse(cr, uid, emp_id[0], context=context) @@ -152,7 +152,7 @@ class hr_analytic_timesheet(osv.osv): 'general_account_id': _getGeneralAccount, 'journal_id': _getAnalyticJournal, 'date': lambda self, cr, uid, ctx: ctx.get('date', fields.date.context_today(self,cr,uid,context=ctx)), - 'user_id': lambda obj, cr, uid, ctx: ctx.get('user_id', uid), + 'user_id': lambda obj, cr, uid, ctx: ctx.get('user_id', False) or uid, } def on_change_account_id(self, cr, uid, ids, account_id, user_id): return {'value':{}} diff --git a/addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml b/addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml index 28e886b779f..c96d256b7e2 100644 --- a/addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml +++ b/addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml @@ -106,7 +106,7 @@ - +