[ADD] helpdesk_create_task_from_ticket: this module enriches task information when creating it from a ticket form

This commit is contained in:
Quentin Mondot
2025-01-31 17:10:10 +01:00
committed by Stéphan Sainléger
parent 4d0d5a0995
commit 5d7978729e
7 changed files with 134 additions and 0 deletions

View File

@@ -0,0 +1 @@
from . import project_task

View File

@@ -0,0 +1,28 @@
from odoo import models, api
class ProjectTask(models.Model):
"""
The function "create" is overloaded to adapt the field "user_ids" from the context of helpdesk.ticket to the one of project.task
This function is called when the user clicks on the button "create" in the task field of the ticket form
The function "onchange" is overloaded to adapt the field "user_ids" from the context of helpdesk.ticket to the one of project.task
This function is called when the user clicks on the button "create and modify" in the task field of the ticket form
"""
_inherit = "project.task"
@api.model
def create(self, vals_list):
user_ids = [self.env.context["default_user_ids"]]
result = super(ProjectTask, self.with_context(
default_user_ids=user_ids
)).create(vals_list)
return result
def onchange(self, values, field_name, field_onchange):
user_ids = [self.env.context["default_user_ids"]]
result = super(ProjectTask, self.with_context(
default_user_ids=user_ids
)).onchange(values, field_name, field_onchange)
return result