Compare commits
1 Commits
16.0-porta
...
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>
|
2
helpdesk_portal_ticket_custom/.gitignore
vendored
2
helpdesk_portal_ticket_custom/.gitignore
vendored
@@ -1,2 +0,0 @@
|
||||
*.*~
|
||||
*pyc
|
@@ -1,37 +0,0 @@
|
||||
====================================
|
||||
helpdesk_portal_ticket_custom
|
||||
====================================
|
||||
|
||||
Customization for ticket portal view.
|
||||
|
||||
# Installation
|
||||
|
||||
Use Odoo normal module installation procedure to install
|
||||
`helpdesk_portal_ticket_custom`.
|
||||
|
||||
# Known issues / Roadmap
|
||||
|
||||
None yet.
|
||||
|
||||
# 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
|
||||
|
||||
- Joris Scampucci
|
||||
|
||||
## Funders
|
||||
|
||||
The development of this module has been financially supported by:
|
||||
|
||||
- Elabore (https://elabore.coop)
|
||||
|
||||
## Maintainer
|
||||
|
||||
This module is maintained by Elabore.
|
@@ -1,35 +0,0 @@
|
||||
# Copyright 2024 Joris Scampucci" (Elabore)
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
{
|
||||
"name": "helpdesk_portal_ticket_custom",
|
||||
"version": "16.0.1.0.0",
|
||||
"author": "Elabore",
|
||||
"website": "https://elabore.coop",
|
||||
"maintainer": "Joris Scampucci",
|
||||
"license": "AGPL-3",
|
||||
"category": "Tools",
|
||||
"summary": "Customization for ticket portal view.",
|
||||
# any module necessary for this one to work correctly
|
||||
"depends": [
|
||||
"base",
|
||||
"helpdesk_mgmt",
|
||||
],
|
||||
"qweb": [],
|
||||
"external_dependencies": {
|
||||
"python": [],
|
||||
},
|
||||
# always loaded
|
||||
"data": [
|
||||
"views/portal_ticket_views.xml",
|
||||
],
|
||||
# only loaded in demonstration mode
|
||||
"demo": [],
|
||||
"js": [],
|
||||
"css": [],
|
||||
"installable": True,
|
||||
# Install this module automatically if all dependency have been previously
|
||||
# and independently installed. Used for synergetic or glue modules.
|
||||
"auto_install": False,
|
||||
"application": False,
|
||||
}
|
@@ -1,43 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
|
||||
<template id="ticket_priority_widget_template" name="Priority Widget Template">
|
||||
<span t-attf-class="o_priority_star fa fa-star#{'' if ticket.priority >= ticket_priority else '-o'}" t-attf-title="Priorité: {{'Très haute' if ticket.priority == '3' else 'Haute' if ticket.priority == '2' else 'Moyenne' if ticket.priority == '1' else 'Basse'}}" />
|
||||
</template>
|
||||
|
||||
<template id="ticket_priority_3_stars_template" name="Priority 3 Stars Widget Template">
|
||||
<t t-call="helpdesk_portal_ticket_custom.ticket_priority_widget_template">
|
||||
<t t-set="ticket_priority" t-value="'1'"/>
|
||||
</t>
|
||||
<t t-call="helpdesk_portal_ticket_custom.ticket_priority_widget_template">
|
||||
<t t-set="ticket_priority" t-value="'2'"/>
|
||||
</t>
|
||||
<t t-call="helpdesk_portal_ticket_custom.ticket_priority_widget_template">
|
||||
<t t-set="ticket_priority" t-value="'3'"/>
|
||||
</t>
|
||||
</template>
|
||||
|
||||
<!-- Ticket portal list -->
|
||||
<template id="portal_ticket_list_inherit" inherit_id="helpdesk_mgmt.portal_ticket_list" priority="1">
|
||||
<!-- Add priority field -->
|
||||
<xpath expr="//thead/tr/th[2]" position="after">
|
||||
<th>Priorité</th>
|
||||
</xpath>
|
||||
<xpath expr="//tbody/t/tr/td[2]" position="after">
|
||||
<td>
|
||||
<t t-call="helpdesk_portal_ticket_custom.ticket_priority_3_stars_template">
|
||||
</t>
|
||||
</td>
|
||||
</xpath>
|
||||
</template>
|
||||
|
||||
<template id="portal_ticket_form_inherit" inherit_id="helpdesk_mgmt.portal_helpdesk_ticket_page">
|
||||
<xpath expr="//div[@class='col-9']" position="before">
|
||||
<div>
|
||||
<t t-call="helpdesk_portal_ticket_custom.ticket_priority_3_stars_template">
|
||||
</t>
|
||||
</div>
|
||||
</xpath>
|
||||
</template>
|
||||
|
||||
</odoo>
|
Reference in New Issue
Block a user