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 @@
-
+
diff --git a/addons/hr_timesheet_sheet/hr_timesheet_sheet.py b/addons/hr_timesheet_sheet/hr_timesheet_sheet.py
index 9226787e908..5bddf20ae69 100644
--- a/addons/hr_timesheet_sheet/hr_timesheet_sheet.py
+++ b/addons/hr_timesheet_sheet/hr_timesheet_sheet.py
@@ -250,7 +250,18 @@ 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 context is None:
+ context = {}
+ 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]
+
class hr_timesheet_line(osv.osv):
_inherit = "hr.analytic.timesheet"