[IMP]Improved code to open contract wizard from hr timesheet

bzr revid: cod@tinyerp.com-20140107061157-lt1b0qvvms8a0qdi
This commit is contained in:
Chirag Dodiya (OpenERP) 2014-01-07 11:41:57 +05:30
parent d9ab20e1b9
commit 9a3ce1a5cc
1 changed files with 2 additions and 1 deletions

View File

@ -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]