Skip to content
Snippets Groups Projects
Commit 174612e4 authored by Yash Vaishnav's avatar Yash Vaishnav
Browse files

[FIX] hr_timesheet: fix task_id field records when creating a timesheet


To reproduce the issue, follow these steps:

1. Install the Timesheet and Project.
2. From the settings menu, create a new company.
3. Create a project using the newly created company(e.g. New Company) and add
   a task to it.
4. Open the Timesheet application and create a new timesheet.
5. In the timesheet, select the project created in step 3, and observe that the
dropdown for tasks does not display any task.

Cause for this issue:
-The timesheet application has a domain set for the task field where the company
associated with the task_id should be the same as the company selected in the
current environment.
-However, when a new project is created with a 'New Company', the tasks
associated with it also have the  'New Company' assigned to them. On the other
hand, the current environment has a default company called 'Your Company'
associated with it.
-Therefore, due to this domain setting, the task field does
not display any tasks since there are no tasks associated with the
'Your Company' in the current environment.

Fix:
Since the cause of the issue is related to the company domain set in the task
field, we can solve it by removing it from the domain.

task-3323027

closes odoo/odoo#122631

Signed-off-by: default avatarXavier Bol (xbo) <xbo@odoo.com>
parent 5a7fa16c
No related branches found
No related tags found
No related merge requests found
......@@ -46,7 +46,7 @@ class AccountAnalyticLine(models.Model):
task_id = fields.Many2one(
'project.task', 'Task', compute='_compute_task_id', store=True, readonly=False, index=True,
domain="[('company_id', '=', company_id), ('project_id.allow_timesheets', '=', True), ('project_id', '=?', project_id)]")
domain="[('project_id.allow_timesheets', '=', True), ('project_id', '=?', project_id)]")
project_id = fields.Many2one(
'project.project', 'Project', compute='_compute_project_id', store=True, readonly=False,
domain=_domain_project_id)
......
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