From c0c5ca4b44ef920a45dddc1c4f880f1a14afac75 Mon Sep 17 00:00:00 2001 From: "Xavier BOL (xbo)" Date: Mon, 2 Jan 2023 18:11:01 +0000 Subject: [PATCH] [IMP] hr_timesheet: avoid select internal project in task views Before this commit, when the user creates a task in the (quick create) form view of task, he can select the internal project. The goal of this project is to contain the timesheets representing the time offs of each employee. This commit filter the projects available for the task creation/edition to be sure the user cannot select internal project. closes odoo/odoo#109002 Related: odoo/enterprise#35377 Signed-off-by: Xavier Bol (xbo) --- addons/hr_timesheet/models/project.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/addons/hr_timesheet/models/project.py b/addons/hr_timesheet/models/project.py index 67c1ecd5ab8..e2a96e5e5b2 100644 --- a/addons/hr_timesheet/models/project.py +++ b/addons/hr_timesheet/models/project.py @@ -237,6 +237,8 @@ class Task(models.Model): _name = "project.task" _inherit = "project.task" + project_id = fields.Many2one(domain=[('is_internal_project', '=', False)]) + display_project_id = fields.Many2one(domain=[('is_internal_project', '=', False)]) analytic_account_active = fields.Boolean("Active Analytic Account", compute='_compute_analytic_account_active', compute_sudo=True) allow_timesheets = fields.Boolean("Allow timesheets", related='project_id.allow_timesheets', help="Timesheets can be logged on this task.", readonly=True) remaining_hours = fields.Float("Remaining Hours", compute='_compute_remaining_hours', store=True, readonly=True, help="Number of allocated hours minus the number of hours spent.")