[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) <yti@odoo.com>
This commit is contained in:
Barad Mahendra
2020-03-31 10:03:43 +00:00
parent def8817d72
commit 14137c8d09
@@ -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)