From d9ab20e1b91fa0f2c78557e672424930943f74ac Mon Sep 17 00:00:00 2001 From: "Chirag Dodiya (OpenERP)" Date: Mon, 23 Dec 2013 17:54:33 +0530 Subject: [PATCH] [IMP] Improved code of name_create method bzr revid: cod@tinyerp.com-20131223122433-9svu8iyoruutdmjd --- addons/hr_timesheet_sheet/hr_timesheet_sheet.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/hr_timesheet_sheet/hr_timesheet_sheet.py b/addons/hr_timesheet_sheet/hr_timesheet_sheet.py index 43defba113f..93ef30e984b 100644 --- a/addons/hr_timesheet_sheet/hr_timesheet_sheet.py +++ b/addons/hr_timesheet_sheet/hr_timesheet_sheet.py @@ -254,7 +254,9 @@ class account_analytic_account(osv.osv): _inherit = "account.analytic.account" def name_create(self, cr, uid, name, context=None): - if context.get('default_use_timesheets') == False: + if context is None: + context = {} + if not context.get('default_use_timesheets', False): return super(account_analytic_account, self).name_create(cr, uid, name, context=context) rec_id = self.create(cr, uid, {self._rec_name: name}, context) return self.name_get(cr, uid, [rec_id], context)[0]