From fbfe9936a190b6fe9fe3c0d3c011ed80f2b1a0d4 Mon Sep 17 00:00:00 2001 From: "Chirag Dodiya (OpenERP)" Date: Mon, 23 Dec 2013 17:01:38 +0530 Subject: [PATCH 1/5] [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" From bda62ace298f77395123107d62ab2c7f074d951c Mon Sep 17 00:00:00 2001 From: "Chirag Dodiya (OpenERP)" Date: Mon, 23 Dec 2013 17:38:12 +0530 Subject: [PATCH 2/5] [IMP]Improved code bzr revid: cod@tinyerp.com-20131223120812-0u2w42i9neaqn76n --- addons/hr_timesheet_sheet/hr_timesheet_sheet.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/hr_timesheet_sheet/hr_timesheet_sheet.py b/addons/hr_timesheet_sheet/hr_timesheet_sheet.py index defdb8a9767..43defba113f 100644 --- a/addons/hr_timesheet_sheet/hr_timesheet_sheet.py +++ b/addons/hr_timesheet_sheet/hr_timesheet_sheet.py @@ -254,7 +254,7 @@ 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: + if 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] From d9ab20e1b91fa0f2c78557e672424930943f74ac Mon Sep 17 00:00:00 2001 From: "Chirag Dodiya (OpenERP)" Date: Mon, 23 Dec 2013 17:54:33 +0530 Subject: [PATCH 3/5] [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] From 9a3ce1a5ccaea171b2919084711756ddd753e821 Mon Sep 17 00:00:00 2001 From: "Chirag Dodiya (OpenERP)" Date: Tue, 7 Jan 2014 11:41:57 +0530 Subject: [PATCH 4/5] [IMP]Improved code to open contract wizard from hr timesheet bzr revid: cod@tinyerp.com-20140107061157-lt1b0qvvms8a0qdi --- addons/hr_timesheet_sheet/hr_timesheet_sheet.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/hr_timesheet_sheet/hr_timesheet_sheet.py b/addons/hr_timesheet_sheet/hr_timesheet_sheet.py index 93ef30e984b..5bddf20ae69 100644 --- a/addons/hr_timesheet_sheet/hr_timesheet_sheet.py +++ b/addons/hr_timesheet_sheet/hr_timesheet_sheet.py @@ -256,7 +256,8 @@ class account_analytic_account(osv.osv): def name_create(self, cr, uid, name, context=None): if context is None: context = {} - if not context.get('default_use_timesheets', False): + group_template_required = self.pool['res.users'].has_group(cr, uid, 'account_analytic_analysis.group_template_required') + if not context.get('default_use_timesheets', False) or group_template_required: 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] From f777b31ac20eb1a7080ee24b55dfcfba6d38210f Mon Sep 17 00:00:00 2001 From: "Chirag Dodiya (OpenERP)" Date: Tue, 7 Jan 2014 16:29:59 +0530 Subject: [PATCH 5/5] [IMP]set default_use_timesheets true in analytic user function bzr revid: cod@tinyerp.com-20140107105959-kc7t6fav73xvegn8 --- addons/analytic_user_function/analytic_user_function_view.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/analytic_user_function/analytic_user_function_view.xml b/addons/analytic_user_function/analytic_user_function_view.xml index ca148175c5a..147e96f0be0 100644 --- a/addons/analytic_user_function/analytic_user_function_view.xml +++ b/addons/analytic_user_function/analytic_user_function_view.xml @@ -66,7 +66,7 @@ - + @@ -79,7 +79,7 @@ - +