[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) <xbo@odoo.com>
This commit is contained in:
Xavier BOL (xbo)
2023-01-10 18:54:40 +01:00
parent 4217f9662e
commit c0c5ca4b44
+2
View File
@@ -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.")