Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop a new grievance redress mechanism module as a replacement for the oca helpdesk module #574

Open
wants to merge 15 commits into
base: 17.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file added spp_grm/README.rst
Empty file.
2 changes: 2 additions & 0 deletions spp_grm/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import controllers
from . import models
48 changes: 48 additions & 0 deletions spp_grm/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

{
"name": "OpenSPP - Grievance Redress Mechanism",
"summary": """
Grievance redress mechanism module for OpenSPP""",
"version": "17.0.1.0.0",
"sequence": 1,
"author": "OpenSPP.org",
"website": "https://github.com/OpenSPP/openspp-modules",
"license": "LGPL-3",
"development_status": "Beta",
"category": "OpenSPP",
"external_dependencies": {"python": []},
"maintainers": ["jeremi", "gonzalesedwin1123"],
"depends": [
"base",
"mail",
"portal",
"g2p_registry_base",
"g2p_registry_individual",
"g2p_registry_group",
"spp_area",
"spp_user_roles",
],
"data": [
"data/grm_data.xml",
"data/mail_alias.xml",
"data/mail_templates.xml",
"security/grm_security.xml",
"security/ir.model.access.csv",
"data/user_roles.xml",
"views/res_partner_views.xml",
"views/grm_ticket_menu.xml",
"views/grm_ticket_stage_views.xml",
"views/grm_ticket_category_views.xml",
"views/grm_ticket_channel_views.xml",
"views/grm_ticket_tag_views.xml",
"views/grm_ticket_views.xml",
"views/grm_portal_templates.xml",
],
"assets": {},
"demo": [],
"images": [],
"application": True,
"installable": True,
"auto_install": False,
}
1 change: 1 addition & 0 deletions spp_grm/controllers/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import grm_portal
54 changes: 54 additions & 0 deletions spp_grm/controllers/grm_portal.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import logging

from odoo import http
from odoo.http import request

from odoo.addons.portal.controllers.portal import CustomerPortal

_logger = logging.getLogger(__name__)


class SPPGrmPortal(CustomerPortal):
@http.route(["/my/tickets", "/my/tickets/page/<int:page>"], type="http", auth="user", website=True)
def portal_my_tickets(self, page=1, **kw):
partner = request.env.user.partner_id
ticket = request.env["spp.grm.ticket"]
domain = [("partner_id", "=", partner.id)]

# Pagination logic
tickets = ticket.search(domain)
values = {
"tickets": tickets,
"page_name": "tickets",
}
return request.render("spp_grm.portal_my_tickets", values)

@http.route(["/my/ticket/new"], type="http", auth="user", website=True)
def portal_ticket_new(self, **kw):
categories = request.env["spp.grm.ticket.category"].search([])
channels = request.env["spp.grm.ticket.channel"].search([])
return request.render(
"spp_grm.portal_create_ticket",
{
"categories": categories,
"channels": channels,
"page_name": "tickets",
"ticket": "new",
},
)

@http.route(["/my/ticket/submit"], type="http", auth="user", website=True, csrf=True)
def portal_ticket_submit(self, **kw):
partner = request.env.user.partner_id
vals = {
"name": kw.get("ticket_name"),
"description": kw.get("description"),
"category_id": kw.get("category_id"),
"channel_id": request.env.ref("spp_grm.grm_ticket_channel_web").id,
"partner_id": partner.id,
}
ticket = request.env["spp.grm.ticket"].sudo().create(vals)

ticket.send_ticket_confirmation_email(ticket)

return request.redirect("/my/tickets")
94 changes: 94 additions & 0 deletions spp_grm/data/grm_data.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<data>
<record model="ir.module.category" id="module_openspp_grm_category">
<field name="name">Grievance Redress Mechanism</field>
<field name="description">Grievance Redress Mechanism (GRM) for OpenSPP.</field>
<field name="sequence">9</field>
</record>
</data>
<data noupdate="1">
<!-- Sequence -->
<record id="grm_ticket_sequence" model="ir.sequence">
<field name="name">GRM Ticket Sequence</field>
<field name="code">spp.grm.ticket.sequence</field>
<field name="padding">6</field>
<field name="implementation">no_gap</field>
<field eval="1" name="number_next" />
<field eval="1" name="number_increment" />
<field name="prefix">%(range_year)s-</field>
<field eval="True" name="use_date_range" />
<field name="company_id" />
</record>
<!-- Stages -->
<record id="grm_ticket_stage_new" model="spp.grm.ticket.stage">
<field name="sequence">1</field>
<field name="name">New</field>
<field name="unattended">True</field>
<field name="closed">False</field>
<field name="company_id" />
</record>
<record id="grm_ticket_stage_in_progress" model="spp.grm.ticket.stage">
<field name="sequence">2</field>
<field name="name">In Progress</field>
<field name="unattended">False</field>
<field name="closed">False</field>
<field name="company_id" />
</record>
<record id="grm_ticket_stage_awaiting" model="spp.grm.ticket.stage">
<field name="sequence">3</field>
<field name="name">Awaiting</field>
<field name="unattended">False</field>
<field name="closed">False</field>
<field name="company_id" />
</record>
<record id="grm_ticket_stage_done" model="spp.grm.ticket.stage">
<field name="sequence">4</field>
<field name="name">Done</field>
<field name="unattended">False</field>
<field name="closed">True</field>
<field name="fold">True</field>
<!-- <field name="mail_template_id" ref="spp_grm.closed_ticket_template" /> -->
<field name="company_id" />
</record>
<record id="grm_ticket_stage_cancelled" model="spp.grm.ticket.stage">
<field name="sequence">5</field>
<field name="name">Cancelled</field>
<field name="unattended">False</field>
<field name="closed">True</field>
<field name="fold">True</field>
<!-- <field name="mail_template_id" ref="spp_grm.closed_ticket_template" /> -->
<field name="company_id" />
</record>
<record id="grm_ticket_stage_rejected" model="spp.grm.ticket.stage">
<field name="sequence">6</field>
<field name="name">Rejected</field>
<field name="unattended">False</field>
<field name="closed">True</field>
<field name="fold">True</field>
<!-- <field name="mail_template_id" ref="spp_grm.closed_ticket_template" /> -->
<field name="company_id" />
</record>
<!-- Channels -->
<record id="grm_ticket_channel_web" model="spp.grm.ticket.channel">
<field name="name">Web</field>
</record>
<record id="grm_ticket_channel_email" model="spp.grm.ticket.channel">
<field name="name">Email</field>
</record>
<record id="grm_ticket_channel_phone" model="spp.grm.ticket.channel">
<field name="name">Phone</field>
</record>
<record id="grm_ticket_channel_other" model="spp.grm.ticket.channel">
<field name="name">Other</field>
</record>
<!-- GRM Ticket-related subtypes for messaging / Chatter -->
<record id="grm_tck_created" model="mail.message.subtype">
<field name="name">Ticket Created</field>
<field name="res_model">spp.grm.ticket</field>
<field name="default" eval="False" />
<field name="hidden" eval="False" />
<field name="description">Ticket created</field>
</record>
</data>
</odoo>
15 changes: 15 additions & 0 deletions spp_grm/data/mail_alias.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<odoo noupdate="1">
<!-- Email Domain Configuration -->
<record id="mail_alias_domain" model="mail.alias.domain">
<field name="name">yourdomain.com</field>
</record>

<!-- Email Alias for GRM Ticket -->
<record id="alias_grm_ticket" model="mail.alias">
<field name="alias_name">helpdesk</field>
<field name="alias_model_id" ref="model_spp_grm_ticket" />
<field name="alias_contact">everyone</field>
<field name="alias_force_thread_id">0</field>
<field name="alias_domain_id" ref="mail_alias_domain" />
</record>
</odoo>
43 changes: 43 additions & 0 deletions spp_grm/data/mail_templates.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo noupdate="1">
<record id="ticket_submission_confirmation" model="mail.template">
<field name="name">Ticket Submission Confirmation</field>
<field name="model_id" ref="model_spp_grm_ticket" />
<field name="subject">Your Ticket: {{ object.number }} has been submitted</field>
<field name="email_from">{{ (user.email or 'support@yourdomain.com') }}</field>
<field name="email_to">{{ object.partner_id.email }}</field>
<field name="auto_delete" eval="True" />
<field name="lang">{{ object.partner_id.lang }}</field>
<field name="body_html" type="html">
<div style="margin: 0px; padding: 0px;">
<p style="margin: 0px; padding: 0px; font-size: 13px;">
Dear <t t-out="object.partner_id and object.partner_id.name or ''">Registrant Name</t>,

<p
>Thank you for reaching out to us. Your ticket has been successfully created with the following details:</p>

<ul>
<li><strong>Ticket No.:</strong> <t t-out="object.number or ''">2024-00000</t></li>
<li><strong>Ticket Name:</strong> <t t-out="object.name or ''">Ticket Name</t></li>
<li><strong>Description:</strong> <t
t-out="object.description or ''"
>Description</t></li>
<li><strong>Category:</strong> <t
t-out="object.category_id and object.category_id.name or ''"
>Category</t></li>
<li><strong>Channel:</strong> <t
t-out="object.channel_id and object.channel_id.name or ''"
>Channel</t></li>
</ul>

<p>We will get back to you shortly. You can track the status of your ticket through the <a
href="/my/tickets"
>Ticket Portal</a>.</p>

<p>Best regards,<br />
The Support Team</p>
</p>
</div>
</field>
</record>
</odoo>
56 changes: 56 additions & 0 deletions spp_grm/data/user_roles.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<odoo noupdate="1">
<!-- Global Support Manager -->
<record id="spp_user_roles.global_role_support_manager" model="res.users.role">
<field name="name">Global Support Manager</field>
<field name="role_type">global</field>
<field
name="comment"
>This role can supervise and manage all support requests and activities across all areas.</field>
<field
name="implied_ids"
eval="
[
Command.link(ref('base.group_user')),
Command.link(ref('spp_grm.group_grm_manager')),
Command.link(ref('g2p_registry_base.group_g2p_registrar')),
]"
/>
</record>

<!-- Global Support -->
<record id="spp_user_roles.global_role_support" model="res.users.role">
<field name="name">Global Support</field>
<field name="role_type">global</field>
<field
name="comment"
>This role is allowed to view and respond to support requests from any areas.</field>
<field
name="implied_ids"
eval="
[
Command.link(ref('base.group_user')),
Command.link(ref('spp_grm.group_grm_user')),
Command.link(ref('g2p_registry_base.group_g2p_registrar')),
]"
/>
</record>

<!-- Local Support -->
<record id="spp_user_roles.local_role_support" model="res.users.role">
<field name="name">Local Support</field>
<field name="role_type">local</field>
<field
name="comment"
>This role is allowed to view and respond to support requests only from their assigned area.</field>
<field
name="implied_ids"
eval="
[
Command.link(ref('base.group_user')),
Command.link(ref('spp_grm.group_grm_user')),
Command.link(ref('g2p_registry_base.group_g2p_registrar')),
]"
/>
</record>

</odoo>
6 changes: 6 additions & 0 deletions spp_grm/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from . import grm_ticket
from . import grm_ticket_stage
from . import grm_ticket_tag
from . import grm_ticket_channel
from . import grm_ticket_category
from . import res_partner
Loading
Loading