Skip to content
Snippets Groups Projects
Commit 2c9d14cf authored by Nisha patel's avatar Nisha patel Committed by Barad Mahendra
Browse files

[FIX] hr_timesheet: Allow to update the empty description on timesheet


Currently, In timesheet module when we update the description of
existing entry and if the description is empty then it generates
required field error.

So in this commit, when a description updated as an empty then we
set a default '/' in the description.

closes odoo/odoo#55370

Taskid: 2301377
Closes: #54726
X-original-commit: 10cecadd05f0349765dc9cdb111e91c2d6d423b4
Signed-off-by: default avatarYannick Tivisse (yti) <yti@odoo.com>
parent 365dc62c
No related branches found
No related tags found
No related merge requests found
......@@ -80,7 +80,7 @@ class AccountAnalyticLine(models.Model):
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'] = _('/')
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)
......@@ -98,6 +98,8 @@ class AccountAnalyticLine(models.Model):
raise AccessError(_("You cannot access timesheets that are not yours."))
values = self._timesheet_preprocess(values)
if 'name' in values and not values.get('name'):
values['name'] = '/'
result = super(AccountAnalyticLine, self).write(values)
# applied only for timesheet
self.filtered(lambda t: t.project_id)._timesheet_postprocess(values)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment