[ADD] helpdesk_create_task_from_ticket: this module enriches task information when creating it from a ticket form
This commit is contained in:
28
helpdesk_create_task_from_ticket/models/project_task.py
Normal file
28
helpdesk_create_task_from_ticket/models/project_task.py
Normal 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
|
Reference in New Issue
Block a user