summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authorBarad Mahendra <mba@openerp.com>2020-03-31 09:52:08 +0000
committerBarad Mahendra <mba@openerp.com>2020-03-31 10:03:43 +0000
commit14137c8d09a7881026e5b8eda8561124d85c95da (patch)
treea3674d5a0b59ef22e96c2f47c233755a45c4bbc6 /addons
parentdef8817d727a392d76f18b654ffa01be99135ace (diff)
[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>
Diffstat (limited to 'addons')
-rw-r--r--addons/hr_timesheet/models/hr_timesheet.py3
1 files changed, 3 insertions, 0 deletions
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)