From fbfe9936a190b6fe9fe3c0d3c011ed80f2b1a0d4 Mon Sep 17 00:00:00 2001 From: "Chirag Dodiya (OpenERP)" Date: Mon, 23 Dec 2013 17:01:38 +0530 Subject: [PATCH] [IMP]override name_create method of analytic account for not do not open contract page on quick create bzr revid: cod@tinyerp.com-20131223113138-pj0bgtf31lh5jcg8 --- addons/hr_timesheet_sheet/hr_timesheet_sheet.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/addons/hr_timesheet_sheet/hr_timesheet_sheet.py b/addons/hr_timesheet_sheet/hr_timesheet_sheet.py index 9226787e908..defdb8a9767 100644 --- a/addons/hr_timesheet_sheet/hr_timesheet_sheet.py +++ b/addons/hr_timesheet_sheet/hr_timesheet_sheet.py @@ -250,7 +250,15 @@ class account_analytic_line(osv.osv): #if we don't get the dates from the timesheet, we return the default value from super() return res - +class account_analytic_account(osv.osv): + _inherit = "account.analytic.account" + + def name_create(self, cr, uid, name, context=None): + if not context.get('default_use_timesheets') == True: + 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] + class hr_timesheet_line(osv.osv): _inherit = "hr.analytic.timesheet"