From 14137c8d09a7881026e5b8eda8561124d85c95da Mon Sep 17 00:00:00 2001 From: Barad Mahendra Date: Tue, 31 Mar 2020 09:52:08 +0000 Subject: [PATCH] [MOV] hr_timehseet: set default value '/' for name(description) on timesheet. Currently the code for default name is inside the timesheet_grid so on community the name(description) of the analytic line is required. so move the default name code from timesheet_grid to hr_timesheet. TaskID: 2176065 Related Enteprise PR: https://github.com/odoo/enterprise/pull/9561 closes odoo/odoo#48657 Closes: #48657 Related: odoo/enterprise#9561 Signed-off-by: Yannick Tivisse (yti) --- addons/hr_timesheet/models/hr_timesheet.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/addons/hr_timesheet/models/hr_timesheet.py b/addons/hr_timesheet/models/hr_timesheet.py index 028d411ea1b..0ce9cf67112 100644 --- a/addons/hr_timesheet/models/hr_timesheet.py +++ b/addons/hr_timesheet/models/hr_timesheet.py @@ -87,6 +87,9 @@ class AccountAnalyticLine(models.Model): user_map = {employee.user_id.id: employee.id for employee in employees} for vals in vals_list: + # when the name is not provide by the 'Add a line', we set a default one + if vals.get('project_id') and not vals.get('name'): + vals['name'] = _('/') # compute employee only for timesheet lines, makes no sense for other lines if not vals.get('employee_id') and vals.get('project_id'): vals['employee_id'] = user_map.get(vals.get('user_id') or default_user_id)