Compare commits
1 Commits
16.0-exclu
...
delete-unu
Author | SHA1 | Date | |
---|---|---|---|
ef07e6322e |
2
helpdesk_create_task_from_ticket/.gitignore
vendored
2
helpdesk_create_task_from_ticket/.gitignore
vendored
@@ -1,2 +0,0 @@
|
|||||||
*.*~
|
|
||||||
*pyc
|
|
@@ -1,53 +0,0 @@
|
|||||||
================================
|
|
||||||
helpdesk_create_task_from_ticket
|
|
||||||
================================
|
|
||||||
|
|
||||||
This module changes the behavior of the buttons "create" and "create and edit" of the field `task` in a ticket form.
|
|
||||||
|
|
||||||
It automatically fills up these tasks fields
|
|
||||||
|
|
||||||
```
|
|
||||||
Ticket (helpdesk.ticke) / Tâche (project.task)
|
|
||||||
|
|
||||||
Intitulé (name) --> Titre (name)
|
|
||||||
Utilisateur assigné (user_id) --> Assignés (user_ids)
|
|
||||||
Projet (project_id) --> Projet (project_id)
|
|
||||||
Contact (partner_id) --> Client (partner_id)
|
|
||||||
Catégorie (category_id) --> service (service_id)
|
|
||||||
Request Type (request_type_id) --> Type de demande (request_type_id)
|
|
||||||
Priorité (priority) --> Priorité (priority)
|
|
||||||
```
|
|
||||||
|
|
||||||
# Installation
|
|
||||||
|
|
||||||
Use Odoo normal module installation procedure to install
|
|
||||||
`helpdesk_create_task_from_ticket`.
|
|
||||||
|
|
||||||
# Known issues / Roadmap
|
|
||||||
|
|
||||||
A current limitation is that one task can be linked to many tickets.
|
|
||||||
Thus, the above task fields are filled up at the creation of the task from a ticket form
|
|
||||||
but are not updated when the linked tickets are updated.
|
|
||||||
|
|
||||||
# Bug Tracker
|
|
||||||
|
|
||||||
Bugs are tracked on `our issues website <https://github.com/elabore-coop/helpdesk-tools/issues>`\_. In case of
|
|
||||||
trouble, please check there if your issue has already been
|
|
||||||
reported. If you spotted it first, help us smashing it by providing a
|
|
||||||
detailed and welcomed feedback.
|
|
||||||
|
|
||||||
# Credits
|
|
||||||
|
|
||||||
## Contributors
|
|
||||||
|
|
||||||
- Quentin Mondot
|
|
||||||
|
|
||||||
## Funders
|
|
||||||
|
|
||||||
The development of this module has been financially supported by:
|
|
||||||
|
|
||||||
- Elabore (https://elabore.coop)
|
|
||||||
|
|
||||||
## Maintainer
|
|
||||||
|
|
||||||
This module is maintained by Elabore.
|
|
@@ -1 +0,0 @@
|
|||||||
from . import models
|
|
@@ -1,26 +0,0 @@
|
|||||||
# Copyright 2024 Quentin Mondot
|
|
||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
|
||||||
{
|
|
||||||
"name": "helpdesk_create_task_from_ticket",
|
|
||||||
"version": "16.0.1.0.0",
|
|
||||||
"author": "Elabore",
|
|
||||||
"website": "https://elabore.coop",
|
|
||||||
"maintainer": "Quentin Mondot",
|
|
||||||
"license": "AGPL-3",
|
|
||||||
"category": "Tools",
|
|
||||||
"summary": "This module enriches task information when creating it from a ticket form.",
|
|
||||||
"depends": [
|
|
||||||
"base",
|
|
||||||
"helpdesk_mgmt",
|
|
||||||
"helpdesk_mgmt_project",
|
|
||||||
"helpdesk_request_type", # to create the helpdesk.request.type model and have the field request_type_id in the helpdesk.ticket model
|
|
||||||
"project_request_data", # to have the fields service_id and request_type_id in the project.task model
|
|
||||||
"project_task_add_very_high" # to have priority values 2 and 3 on tasks
|
|
||||||
],
|
|
||||||
"data": [
|
|
||||||
"views/helpdesk_create_task_from_ticket.xml",
|
|
||||||
],
|
|
||||||
"installable": True,
|
|
||||||
"auto_install": False,
|
|
||||||
"application": False,
|
|
||||||
}
|
|
@@ -1 +0,0 @@
|
|||||||
from . import project_task
|
|
@@ -1,71 +0,0 @@
|
|||||||
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):
|
|
||||||
if all(key in self.env.context for key in (
|
|
||||||
"default_user_id",
|
|
||||||
"default_ticket_category_id",
|
|
||||||
"default_ticket_request_type_id"
|
|
||||||
)):
|
|
||||||
user_ids = [self.env.context["default_user_id"]]
|
|
||||||
task_service_id, request_type_id = self._match_task_service_and_request_type(
|
|
||||||
ticket_category_id=self.env.context["default_ticket_category_id"],
|
|
||||||
ticket_request_type_id=self.env.context["default_ticket_request_type_id"]
|
|
||||||
)
|
|
||||||
|
|
||||||
return super(ProjectTask, self.with_context(
|
|
||||||
default_user_ids=user_ids,
|
|
||||||
default_service_id=task_service_id,
|
|
||||||
default_request_type_id=request_type_id
|
|
||||||
)).create(vals_list)
|
|
||||||
|
|
||||||
return super(ProjectTask, self).create(vals_list)
|
|
||||||
|
|
||||||
def onchange(self, values, field_name, field_onchange):
|
|
||||||
if all(key in self.env.context for key in (
|
|
||||||
"default_user_id",
|
|
||||||
"default_ticket_category_id",
|
|
||||||
"default_ticket_request_type_id"
|
|
||||||
)):
|
|
||||||
user_ids = [self.env.context["default_user_id"]]
|
|
||||||
task_service_id, request_type_id = self._match_task_service_and_request_type(
|
|
||||||
ticket_category_id=self.env.context["default_ticket_category_id"],
|
|
||||||
ticket_request_type_id=self.env.context["default_ticket_request_type_id"]
|
|
||||||
)
|
|
||||||
|
|
||||||
return super(ProjectTask, self.with_context(
|
|
||||||
default_user_ids=user_ids,
|
|
||||||
default_service_id=task_service_id,
|
|
||||||
default_request_type_id=request_type_id
|
|
||||||
)).onchange(values, field_name, field_onchange)
|
|
||||||
|
|
||||||
return super(ProjectTask, self).onchange(values, field_name, field_onchange)
|
|
||||||
|
|
||||||
def _match_task_service_and_request_type(
|
|
||||||
self,
|
|
||||||
ticket_category_id: int,
|
|
||||||
ticket_request_type_id: int
|
|
||||||
) -> tuple[int, int]:
|
|
||||||
helpdesk_ticket_category = self.env["helpdesk.ticket.category"].search(
|
|
||||||
[("id", "=", ticket_category_id)],
|
|
||||||
limit=1
|
|
||||||
)
|
|
||||||
task_service = self.env["task.service"].search([("name", "=", helpdesk_ticket_category.name)])
|
|
||||||
|
|
||||||
helpdesk_ticket_request_type = self.env["helpdesk.request.type"].search(
|
|
||||||
[("id", "=", ticket_request_type_id)],
|
|
||||||
limit=1
|
|
||||||
)
|
|
||||||
task_request_type = self.env["request.type"].search([("name", "=", helpdesk_ticket_request_type.name)])
|
|
||||||
|
|
||||||
return task_service.id, task_request_type.id
|
|
@@ -1,23 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<odoo>
|
|
||||||
<record id="ticket_view_form_create_task_from_ticket" model="ir.ui.view">
|
|
||||||
<field name="name">helpdesk.ticket.form.task.from.ticket</field>
|
|
||||||
<field name="model">helpdesk.ticket</field>
|
|
||||||
<field name="inherit_id" ref="helpdesk_mgmt_project.ticket_view_form" />
|
|
||||||
<field name="priority" eval="99" />
|
|
||||||
<field name="arch" type="xml">
|
|
||||||
<xpath expr="//field[@name='task_id'][2]" position="attributes">
|
|
||||||
<attribute name="context">
|
|
||||||
{
|
|
||||||
'default_project_id': project_id,
|
|
||||||
'default_user_id': user_id,
|
|
||||||
'default_partner_id': partner_id,
|
|
||||||
'default_ticket_category_id': category_id,
|
|
||||||
'default_ticket_request_type_id': request_type_id,
|
|
||||||
'default_priority': priority
|
|
||||||
}
|
|
||||||
</attribute>
|
|
||||||
</xpath>
|
|
||||||
</field>
|
|
||||||
</record>
|
|
||||||
</odoo>
|
|
Reference in New Issue
Block a user