From 3366ab55348ab427a93b2bfe1d78a042b3fa2c44 Mon Sep 17 00:00:00 2001 From: "Xavier Bol (xbo)" Date: Thu, 10 Aug 2023 14:35:18 +0000 Subject: [PATCH] [FIX] project_timesheet_holidays: fix task_id field records when creating a timesheet The fix done in 3b966c2f21 remove the `('company_id', '=', company_id)` in the domain of task_id field defined in account.analytic.line in hr_timesheet, but that tuple is reintroduced in `project_timesheet_holidays`. This commit also removes that tuple to be sure we will no longer have that tuple used in the domain of task_id field for timesheets. To reproduce the issue, follow these steps: 1. Install project_timesheet_holidays module. 2. From the settings menu, create a new company. 3. enter in multi-company mode by keeping the current one as active and check the other company in companies switcher. 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. Current behavior: ---------------- The user cannot select a task in another company than the current one. Expected behavior: ----------------- The user should be able to select the task in the another company if he is in multi-company mode. task-3323027 closes odoo/odoo#131870 X-original-commit: d630711e795e7eddeb7b0ec47920f288920aedc6 Signed-off-by: Xavier Bol (xbo) --- addons/project_timesheet_holidays/models/account_analytic.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/addons/project_timesheet_holidays/models/account_analytic.py b/addons/project_timesheet_holidays/models/account_analytic.py index ccc00ba1c89..bb7a5b2f2bb 100644 --- a/addons/project_timesheet_holidays/models/account_analytic.py +++ b/addons/project_timesheet_holidays/models/account_analytic.py @@ -10,8 +10,7 @@ class AccountAnalyticLine(models.Model): holiday_id = fields.Many2one("hr.leave", string='Time Off Request', copy=False) global_leave_id = fields.Many2one("resource.calendar.leaves", string="Global Time Off", ondelete='cascade') - task_id = fields.Many2one(domain="[('company_id', '=', company_id), ('project_id.allow_timesheets', '=', True)," - "('project_id', '=?', project_id), ('is_timeoff_task', '=', False)]") + task_id = fields.Many2one(domain="[('project_id.allow_timesheets', '=', True), ('project_id', '=?', project_id), ('is_timeoff_task', '=', False)]") def _get_redirect_action(self): leave_form_view_id = self.env.ref('hr_holidays.hr_leave_view_form').id