Skip to content

Commit

Permalink
[16.0][ADD] helpdesk_ticket_customer_response: New module helpdesk_ti…
Browse files Browse the repository at this point in the history
…cket_customer_response
  • Loading branch information
peluko00 committed Dec 30, 2024
1 parent 9afb9ec commit 812cfe5
Show file tree
Hide file tree
Showing 21 changed files with 702 additions and 0 deletions.
103 changes: 103 additions & 0 deletions helpdesk_ticket_customer_response/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
=================================
Helpdesk Ticket Customer Response
=================================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:c6d83a14ee5d9e8f7b5ac9c65cc3bf6482df385c0d1f9e996befd495eb071938
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fhelpdesk-lightgray.png?logo=github
:target: https://github.com/OCA/helpdesk/tree/16.0/helpdesk_ticket_customer_response
:alt: OCA/helpdesk
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/helpdesk-16-0/helpdesk-16-0-helpdesk_ticket_customer_response
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/helpdesk&target_branch=16.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

Change ticket stage when customer answered the ticket from portal or
mail.

**Table of contents**

.. contents::
:local:

Configuration
=============

You need to setup the source stages when ticket is answered by customer
and the destination stage. To setup this configuration you have to go to
Helpdesk > Settings > Teams > Automatic change stage when customer
answered

Usage
=====

Answer a ticket with customer account through portal in stage that you
setup in configuration of team and that ticket will go to the the stage
you specified in configuration.

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/helpdesk/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/helpdesk/issues/new?body=module:%20helpdesk_ticket_customer_response%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
-------

* Antoni Marroig
* APSL-Nagarro

Contributors
------------

[APSL-Nagarro](https://apsl.tech):

- Antoni Marroig <amarroig@apsl.net>

Maintainers
-----------

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

.. |maintainer-peluko00| image:: https://github.com/peluko00.png?size=40px
:target: https://github.com/peluko00
:alt: peluko00

Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-peluko00|

This module is part of the `OCA/helpdesk <https://github.com/OCA/helpdesk/tree/16.0/helpdesk_ticket_customer_response>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
4 changes: 4 additions & 0 deletions helpdesk_ticket_customer_response/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from . import models
from . import controllers
18 changes: 18 additions & 0 deletions helpdesk_ticket_customer_response/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright 2024 Antoni Marroig(APSL-Nagarro)<amarroig@apsl.net>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
"name": "Helpdesk Ticket Customer Response",
"summary": "Change ticket stage when customer response",
"version": "16.0.1.0.0",
"category": "Helpdesk",
"website": "https://github.com/OCA/helpdesk",
"author": "Antoni Marroig, APSL-Nagarro, Odoo Community Association (OCA)",
"maintainers": ["peluko00"],
"license": "AGPL-3",
"application": False,
"installable": True,
"depends": ["helpdesk_mgmt"],
"data": [
"views/helpdesk_ticket_team.xml",
],
}
3 changes: 3 additions & 0 deletions helpdesk_ticket_customer_response/controllers/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from . import mail
95 changes: 95 additions & 0 deletions helpdesk_ticket_customer_response/controllers/mail.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# Copyright 2024 Antoni Marroig(APSL-Nagarro)<amarroig@apsl.net>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

import odoo.http as http
from odoo.http import request
from odoo.tools import plaintext2html

from odoo.addons.portal.controllers.mail import PortalChatter, _message_post_helper


class HelpdeskCustomerResponse(PortalChatter):
def change_status_ticket_from_portal(self, post_values):
if post_values["res_model"] == "helpdesk.ticket":
ticket_id = post_values["res_id"]
ticket = request.env["helpdesk.ticket"].sudo().browse(int(ticket_id))
if (
ticket
and request.env.user.partner_id.id == ticket.partner_id.id
and ticket.team_id.change_customer_reponse_stage_tickets
and ticket.stage_id in ticket.team_id.customer_src_stage_ids
):
ticket.stage_id = ticket.team_id.customer_dst_stage_id.id

@http.route(
["/mail/chatter_post"],
type="json",
methods=["POST"],
auth="public",
website=True,
)
def portal_chatter_post(
self,
res_model,
res_id,
message,
attachment_ids=None,
attachment_tokens=None,
**kw
):
if not self._portal_post_has_content(
res_model,
res_id,
message,
attachment_ids=attachment_ids,
attachment_tokens=attachment_tokens,
**kw
):
return

res_id = int(res_id)

self._portal_post_check_attachments(
attachment_ids or [], attachment_tokens or []
)

result = {"default_message": message}
# message is received in plaintext and saved in html
if message:
message = plaintext2html(message)
post_values = {
"res_model": res_model,
"res_id": res_id,
"message": message,
"send_after_commit": False,
"attachment_ids": False, # will be added afterward
}
post_values.update(
(fname, kw.get(fname)) for fname in self._portal_post_filter_params()
)
post_values["_hash"] = kw.get("hash")
message = _message_post_helper(**post_values)
result.update({"default_message_id": message.id})

if attachment_ids:
# sudo write the attachment to bypass the read access
# verification in mail message
record = request.env[res_model].browse(res_id)
message_values = {"res_id": res_id, "model": res_model}
attachments = record._message_post_process_attachments(
[], attachment_ids, message_values
)

if attachments.get("attachment_ids"):
message.sudo().write(attachments)

result.update(
{
"default_attachment_ids": message.attachment_ids.sudo().read(
["id", "name", "mimetype", "file_size", "access_token"]
)
}
)

self.change_status_ticket_from_portal(post_values)
return result
60 changes: 60 additions & 0 deletions helpdesk_ticket_customer_response/i18n/ca.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * helpdesk_ticket_customer_response
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-12-30 07:54+0000\n"
"PO-Revision-Date: 2024-12-30 07:54+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: helpdesk_ticket_customer_response
#: model:ir.model.fields,field_description:helpdesk_ticket_customer_response.field_helpdesk_ticket_team__change_customer_reponse_stage_tickets
msgid "Automatic change stage of tickets answered by customer"
msgstr "Canvi automàtic dels tiquets contestats pel client"

#. module: helpdesk_ticket_customer_response
#: model_terms:ir.ui.view,arch_db:helpdesk_ticket_customer_response.view_helpdesk_team_form_inherit
msgid "Automatic change stage when customer answered"
msgstr "Canvi automàtic d'etapa quan el client respon"

#. module: helpdesk_ticket_customer_response
#: model:ir.model.fields,field_description:helpdesk_ticket_customer_response.field_helpdesk_ticket_team__customer_dst_stage_id
msgid "Customer Destination Ticket Stage"
msgstr "Etapa de destinació del tiquet del client"

#. module: helpdesk_ticket_customer_response
#: model:ir.model.fields,field_description:helpdesk_ticket_customer_response.field_helpdesk_ticket_team__customer_src_stage_ids
msgid "Customer Source Ticket Stages"
msgstr "Etapes d'origen del ticket del client"

#. module: helpdesk_ticket_customer_response
#: model:ir.model,name:helpdesk_ticket_customer_response.model_helpdesk_ticket_team
msgid "Helpdesk Ticket Team"
msgstr "Equip del tiquet del centre d'assistència"

#. module: helpdesk_ticket_customer_response
#: model:ir.model.fields,help:helpdesk_ticket_customer_response.field_helpdesk_ticket_team__customer_src_stage_ids
msgid ""
"The functionality changes the tickets answered by the customer to this "
"stage."
msgstr ""
"La funcionalitat canvia els tiquets contestats pel client a aquesta "
"etapa".

#. module: helpdesk_ticket_customer_response
#: model:ir.model.fields,help:helpdesk_ticket_customer_response.field_helpdesk_ticket_team__customer_dst_stage_id
msgid ""
"The functionality will check for tickets answered by customer that are in "
"these stages."
msgstr ""
"La funcionalitat comprovarà els tiquets contestats pel client que es troben en "
"aquestes etapes".

58 changes: 58 additions & 0 deletions helpdesk_ticket_customer_response/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * helpdesk_ticket_customer_response
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-12-30 07:55+0000\n"
"PO-Revision-Date: 2024-12-30 07:55+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: helpdesk_ticket_customer_response
#: model:ir.model.fields,field_description:helpdesk_ticket_customer_response.field_helpdesk_ticket_team__change_customer_reponse_stage_tickets
msgid "Automatic change stage of tickets answered by customer"
msgstr "Cambio automático de etapa de los tickets respondidos por el cliente"

#. module: helpdesk_ticket_customer_response
#: model_terms:ir.ui.view,arch_db:helpdesk_ticket_customer_response.view_helpdesk_team_form_inherit
msgid "Automatic change stage when customer answered"
msgstr "Cambio automático de etapa de cuando el cliente respondió"

#. module: helpdesk_ticket_customer_response
#: model:ir.model.fields,field_description:helpdesk_ticket_customer_response.field_helpdesk_ticket_team__customer_dst_stage_id
msgid "Customer Destination Ticket Stage"
msgstr "Etapa de destino del ticket del cliente"

#. module: helpdesk_ticket_customer_response
#: model:ir.model.fields,field_description:helpdesk_ticket_customer_response.field_helpdesk_ticket_team__customer_src_stage_ids
msgid "Customer Source Ticket Stages"
msgstr "Etapas de origen del ticket del cliente"

#. module: helpdesk_ticket_customer_response
#: model:ir.model,name:helpdesk_ticket_customer_response.model_helpdesk_ticket_team
msgid "Helpdesk Ticket Team"
msgstr "Equipo de ticket Helpdesk"

#. module: helpdesk_ticket_customer_response
#: model:ir.model.fields,help:helpdesk_ticket_customer_response.field_helpdesk_ticket_team__customer_src_stage_ids
msgid ""
"The functionality changes the tickets answered by the customer to this "
"stage."
msgstr ""
"La funcionalidad cambia los tickets respondidos por el cliente a esta etapa."

#. module: helpdesk_ticket_customer_response
#: model:ir.model.fields,help:helpdesk_ticket_customer_response.field_helpdesk_ticket_team__customer_dst_stage_id
msgid ""
"The functionality will check for tickets answered by customer that are in "
"these stages."
msgstr ""
"La funcionalidad verificará los tickets respondidos por el cliente que estén"
" en estas etapas"
3 changes: 3 additions & 0 deletions helpdesk_ticket_customer_response/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from . import helpdesk_ticket_team
27 changes: 27 additions & 0 deletions helpdesk_ticket_customer_response/models/helpdesk_ticket_team.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Copyright 2024 Antoni Marroig(APSL-Nagarro)<amarroig@apsl.net>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import fields, models


class HelpdeskTicketTeam(models.Model):
_inherit = "helpdesk.ticket.team"

change_customer_reponse_stage_tickets = fields.Boolean(
string="Automatic change stage of tickets answered by customer",
default=False,
)
customer_src_stage_ids = fields.Many2many(
comodel_name="helpdesk.ticket.stage",
relation="change_stage_customer_response",
string="Customer Source Ticket Stages",
help="The functionality changes the tickets answered by the customer to this stage.",
)
customer_dst_stage_id = fields.Many2one(
"helpdesk.ticket.stage",
string="Customer Destination Ticket Stage",
help=(
"The functionality will check for tickets answered by customer "
"that are in these stages."
),
)
2 changes: 2 additions & 0 deletions helpdesk_ticket_customer_response/readme/CONFIGURE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
You need to setup the source stages when ticket is answered by customer and the destination stage.
To setup this configuration you have to go to Helpdesk > Settings > Teams > Automatic change stage when customer answered
2 changes: 2 additions & 0 deletions helpdesk_ticket_customer_response/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
\[APSL-Nagarro\](<https://apsl.tech>):
- Antoni Marroig \<<amarroig@apsl.net>\>
1 change: 1 addition & 0 deletions helpdesk_ticket_customer_response/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Change ticket stage when customer answered the ticket from portal or mail.
1 change: 1 addition & 0 deletions helpdesk_ticket_customer_response/readme/USAGE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Answer a ticket with customer account through portal in stage that you setup in configuration of team and that ticket will go to the the stage you specified in configuration.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 812cfe5

Please sign in to comment.