feat(fusion_helpdesk): customer follow-up + embedded ticket inbox
Squash-merge of feat/helpdesk-customer-followup. The billing and fusion_login_audit work from that branch is already on main (landed separately); this lands only the helpdesk feature. - Identity keystone: submit() forwards partner_email/partner_name/ x_fc_client_label so the central Helpdesk find-or-creates the customer partner and subscribes them as a follower (enables reply emails + magic link). - Embedded in-app 'My Tickets' inbox: server-side scoped read/reply RPC endpoints, per-user seen tracking (fusion.helpdesk.ticket.seen), systray unread badge. Defense-in-depth scope domain + _norm_email normalisation (wildcard emails cannot widen scope). - fusion_helpdesk_central: x_fc_client_label field + list/search views + branded acknowledgement email template. - Deployed and smoke-tested live: nexa central 19.0.1.1.0, entech client 19.0.1.4.1 (requires Contact Creation on the central service account). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2
fusion_helpdesk_central/tests/__init__.py
Normal file
2
fusion_helpdesk_central/tests/__init__.py
Normal file
@@ -0,0 +1,2 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from . import test_identity
|
||||
68
fusion_helpdesk_central/tests/test_identity.py
Normal file
68
fusion_helpdesk_central/tests/test_identity.py
Normal file
@@ -0,0 +1,68 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright 2026 Nexa Systems Inc.
|
||||
# License OPL-1
|
||||
"""Identity-keystone tests for the central helpdesk extensions.
|
||||
|
||||
Runs on an Enterprise environment (helpdesk installed) — e.g. odoo-nexa or
|
||||
odoo-trial. Validates that passing partner_email resolves the customer +
|
||||
follower (native), that the client label is stored, and that the branded
|
||||
acknowledgement only fires for in-app-channel tickets.
|
||||
"""
|
||||
from odoo.tests import TransactionCase, tagged
|
||||
|
||||
|
||||
@tagged('post_install', '-at_install', 'fusion_helpdesk_central')
|
||||
class TestTicketIdentity(TransactionCase):
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
super().setUpClass()
|
||||
cls.team = cls.env['helpdesk.team'].search([], limit=1)
|
||||
|
||||
def _ack_mails(self, ticket):
|
||||
return self.env['mail.mail'].search([
|
||||
('model', '=', 'helpdesk.ticket'),
|
||||
('res_id', '=', ticket.id),
|
||||
]).filtered(lambda m: 'received your request' in (m.subject or ''))
|
||||
|
||||
def test_partner_resolution_follower_and_label(self):
|
||||
ticket = self.env['helpdesk.ticket'].create({
|
||||
'name': 'Keystone test',
|
||||
'team_id': self.team.id,
|
||||
'partner_email': 'keystone.newperson@example.com',
|
||||
'partner_name': 'Key Stone',
|
||||
'x_fc_client_label': 'ENTECH',
|
||||
})
|
||||
self.assertEqual(ticket.x_fc_client_label, 'ENTECH')
|
||||
self.assertTrue(
|
||||
ticket.partner_id,
|
||||
"native create() should find-or-create a partner from partner_email")
|
||||
self.assertEqual(ticket.partner_id.email, 'keystone.newperson@example.com')
|
||||
self.assertIn(
|
||||
ticket.partner_id, ticket.message_partner_ids,
|
||||
"the customer must be subscribed as a follower")
|
||||
|
||||
def test_ack_email_for_inapp_ticket(self):
|
||||
ticket = self.env['helpdesk.ticket'].create({
|
||||
'name': 'Ack test',
|
||||
'team_id': self.team.id,
|
||||
'partner_email': 'ack.person@example.com',
|
||||
'partner_name': 'Ack Person',
|
||||
'x_fc_client_label': 'ENTECH',
|
||||
})
|
||||
self.assertTrue(
|
||||
self._ack_mails(ticket),
|
||||
"an in-app ticket with a customer email should get our ack email")
|
||||
|
||||
def test_no_ack_without_client_label(self):
|
||||
# Simulates an external web-form ticket — no client label, so our
|
||||
# acknowledgement must NOT fire (avoids double-acknowledgement).
|
||||
ticket = self.env['helpdesk.ticket'].create({
|
||||
'name': 'External web ticket',
|
||||
'team_id': self.team.id,
|
||||
'partner_email': 'external.web@example.com',
|
||||
'partner_name': 'External Web',
|
||||
})
|
||||
self.assertFalse(
|
||||
self._ack_mails(ticket),
|
||||
"no client label => our acknowledgement should not send")
|
||||
Reference in New Issue
Block a user