Skip to content

Commit

Permalink
[ADD] helpdesk_ticket_partner_response, helpdesk_ticket_related
Browse files Browse the repository at this point in the history
  • Loading branch information
tarteo committed Feb 14, 2025
1 parent 5506c9f commit 723779c
Show file tree
Hide file tree
Showing 37 changed files with 1,939 additions and 0 deletions.
104 changes: 104 additions & 0 deletions helpdesk_ticket_partner_response/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
================================
Helpdesk Ticket Partner Response
================================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:41ec07506f9e5e571fc48a6559155e4f2b4a8dfa0a9be0bf8b4afef9dd4efab9
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |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_partner_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_partner_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|

Autoupdate ticket stage when a partner posts a message on the ticket
from the portal or by sending an email.

**Table of contents**

.. contents::
:local:

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

Set ticket source and destination stages from where if a message by the
partner is posted autopdation have to be triggered. To setup this
configuration you have to go to Helpdesk > Settings > Teams > Autoupdate
ticket stage

Usage
=====

This module adds the option from helpdesk team to automate the ticket
stage update when a partner posts a message on the same ticket. This is
useful when exists an specific stage for the tickets that his last
update is answer by the partner.

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_partner_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 <[email protected]>

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_partner_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_partner_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_partner_response/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright 2024 Antoni Marroig(APSL-Nagarro)<[email protected]>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
"name": "Helpdesk Ticket Partner Response",
"summary": "Change ticket stage when partner response",
"version": "16.0.1.1.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_partner_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_partner_response/controllers/mail.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# Copyright 2024 Antoni Marroig(APSL-Nagarro)<[email protected]>
# 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.autoupdate_ticket_stage
and ticket.stage_id in ticket.team_id.autopupdate_src_stage_ids
):
ticket.stage_id = ticket.team_id.autopupdate_dest_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
63 changes: 63 additions & 0 deletions helpdesk_ticket_partner_response/i18n/ca.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * helpdesk_ticket_partner_response
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-01-02 09:19+0000\n"
"PO-Revision-Date: 2025-01-02 09:19+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: helpdesk_ticket_partner_response
#: model:ir.model.fields,field_description:helpdesk_ticket_partner_response.field_helpdesk_ticket_team__autoupdate_ticket_stage
#: model_terms:ir.ui.view,arch_db:helpdesk_ticket_partner_response.view_helpdesk_team_form_inherit
msgid "Auto Update Ticket Stage"
msgstr "Etapa d'actualització automàtica de tiquets"

#. module: helpdesk_ticket_partner_response
#: model:ir.model.fields,field_description:helpdesk_ticket_partner_response.field_helpdesk_ticket_team__autopupdate_dest_stage_id
msgid "Autoupdate Destination Stage"
msgstr "Etapa de destinació d'actualització automàtica"

#. module: helpdesk_ticket_partner_response
#: model:ir.model.fields,field_description:helpdesk_ticket_partner_response.field_helpdesk_ticket_team__autopupdate_src_stage_ids
msgid "Autoupdate Source Stages"
msgstr "Etapes d'origen d'actualització automàtica"

#. module: helpdesk_ticket_partner_response
#: model:ir.model,name:helpdesk_ticket_partner_response.model_mail_thread
msgid "Email Thread"
msgstr ""

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

#. module: helpdesk_ticket_partner_response
#: model:ir.model.fields,help:helpdesk_ticket_partner_response.field_helpdesk_ticket_team__autopupdate_src_stage_ids
msgid ""
"If a partner posts a message in a ticket on this stages, the own stage of "
"the ticket will be update by the one set on Autoupdate Destination Stage "
msgstr ""
"Si un soci publica un missatge en un ticket en aquestes etapes, la pròpia "
"etapa de el ticket s'actualitzarà pel que s'estableix a l'etapa de "
"destinació d'actualització automàtica"

#. module: helpdesk_ticket_partner_response
#: model:ir.model.fields,help:helpdesk_ticket_partner_response.field_helpdesk_ticket_team__autopupdate_dest_stage_id
msgid "Target stage on partner's message post "
msgstr "Etapa objectiu a la publicació de missatges del soci"

#. module: helpdesk_ticket_partner_response
#: model:ir.model.fields,help:helpdesk_ticket_partner_response.field_helpdesk_ticket_team__autoupdate_ticket_stage
msgid "Update ticket stage when a new message is registered by the partner."
msgstr "Actualitzar l'etapa del ticket quan el soci registra un missatge nou."
64 changes: 64 additions & 0 deletions helpdesk_ticket_partner_response/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * helpdesk_ticket_partner_response
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-01-02 09:19+0000\n"
"PO-Revision-Date: 2025-01-02 09:19+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: helpdesk_ticket_partner_response
#: model:ir.model.fields,field_description:helpdesk_ticket_partner_response.field_helpdesk_ticket_team__autoupdate_ticket_stage
#: model_terms:ir.ui.view,arch_db:helpdesk_ticket_partner_response.view_helpdesk_team_form_inherit
msgid "Auto Update Ticket Stage"
msgstr "Etapa de actualización automática de tickets"

#. module: helpdesk_ticket_partner_response
#: model:ir.model.fields,field_description:helpdesk_ticket_partner_response.field_helpdesk_ticket_team__autopupdate_dest_stage_id
msgid "Autoupdate Destination Stage"
msgstr "Etapa de destino de actualización automática"

#. module: helpdesk_ticket_partner_response
#: model:ir.model.fields,field_description:helpdesk_ticket_partner_response.field_helpdesk_ticket_team__autopupdate_src_stage_ids
msgid "Autoupdate Source Stages"
msgstr "Etapas de origen de actualización automática"

#. module: helpdesk_ticket_partner_response
#: model:ir.model,name:helpdesk_ticket_partner_response.model_mail_thread
msgid "Email Thread"
msgstr ""

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

#. module: helpdesk_ticket_partner_response
#: model:ir.model.fields,help:helpdesk_ticket_partner_response.field_helpdesk_ticket_team__autopupdate_src_stage_ids
msgid ""
"If a partner posts a message in a ticket on this stages, the own stage of "
"the ticket will be update by the one set on Autoupdate Destination Stage "
msgstr ""
"Si un socio publica un mensaje en un ticket en esta etapa, la propia etapa "
"de el ticket se actualizará según el establecido en la etapa de destino de "
"actualización automática"

#. module: helpdesk_ticket_partner_response
#: model:ir.model.fields,help:helpdesk_ticket_partner_response.field_helpdesk_ticket_team__autopupdate_dest_stage_id
msgid "Target stage on partner's message post "
msgstr "Etapa objetivo en la publicación del mensaje del socio"

#. module: helpdesk_ticket_partner_response
#: model:ir.model.fields,help:helpdesk_ticket_partner_response.field_helpdesk_ticket_team__autoupdate_ticket_stage
msgid "Update ticket stage when a new message is registered by the partner."
msgstr ""
"Etapa de actualización del ticket cuando el socio registra un nuevo mensaje."
Loading

0 comments on commit 723779c

Please sign in to comment.