From fe98fadf610ce3963b30e2ed8c5f0942ad949146 Mon Sep 17 00:00:00 2001 From: gsinghpal Date: Wed, 27 May 2026 15:31:58 -0400 Subject: [PATCH] fix(fusion_helpdesk_central): engagement now posts public chatter for employee MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sending an engagement triggered template.send_mail(), which logged the outbound email to the chatter as a `notification` message with the internal `Note` subtype. That's correct for nexa-side bookkeeping (we don't want the raw email body propagating to the customer), but it meant nothing public was posted — so the entech-side My Tickets inbox showed no activity. The employee couldn't tell their request had been escalated for approval. _fc_reset_engagement now posts a follow-up public message via message_post (subtype mail.mt_comment, message_type='comment') with: ⏳ Awaiting owner approval from . Their decision will appear here when they reply. Our reply: > This survives the entech _public_messages filter (comment + non-internal subtype) and propagates to the employee's My Tickets thread, giving them context AND the engineer's reply without exposing the raw outbound email or the owner's email address. Smoke-tested live on ticket #54: re-engaged with the same owner, the new mail.message (id=348213) is subtype=Discussions / internal=False / message_type=comment, and contains both the awaiting-approval notice and the findings text. _public_messages would surface it. Bumps fusion_helpdesk_central to 19.0.2.4.1. --- fusion_helpdesk_central/__manifest__.py | 2 +- .../models/helpdesk_ticket.py | 48 ++++++++++++++++++- 2 files changed, 48 insertions(+), 2 deletions(-) diff --git a/fusion_helpdesk_central/__manifest__.py b/fusion_helpdesk_central/__manifest__.py index c3ac1091..6adfdbb7 100644 --- a/fusion_helpdesk_central/__manifest__.py +++ b/fusion_helpdesk_central/__manifest__.py @@ -3,7 +3,7 @@ # License OPL-1 { 'name': 'Fusion Helpdesk Central — Client API Keys', - 'version': '19.0.2.4.0', + 'version': '19.0.2.4.1', 'category': 'Productivity', 'summary': 'Admin UI on the central Odoo for issuing per-client API ' 'keys used by fusion_helpdesk client deployments.', diff --git a/fusion_helpdesk_central/models/helpdesk_ticket.py b/fusion_helpdesk_central/models/helpdesk_ticket.py index e1ce4c72..7f49567f 100644 --- a/fusion_helpdesk_central/models/helpdesk_ticket.py +++ b/fusion_helpdesk_central/models/helpdesk_ticket.py @@ -262,13 +262,21 @@ class HelpdeskTicket(models.Model): stored on the ticket so the mail template can show it as the "My Reply" section without context-magic, and so it survives as audit history once the engagement is decided. + + After writing the state, posts a PUBLIC chatter message (subtype + mt_comment) so the message propagates to the employee's My Tickets + inbox on the client side — without it, the engagement email goes + out internally (logged as an auto-generated Note subtype) and + the entech-side inbox shows nothing happened. The employee deserves + to know we're waiting on their owner. """ self.ensure_one() normalised = email_normalize(owner_email or '') or (owner_email or '') + owner_name_clean = (owner_name or '').strip() self.write({ 'x_fc_engagement_state': 'pending', 'x_fc_engagement_email': normalised, - 'x_fc_engagement_name': (owner_name or '').strip(), + 'x_fc_engagement_name': owner_name_clean, 'x_fc_engagement_token': self._fc_new_engagement_token(), 'x_fc_engagement_sent_at': fields.Datetime.now(), 'x_fc_engagement_reminded_at': False, @@ -276,6 +284,44 @@ class HelpdeskTicket(models.Model): 'x_fc_ai_summary': ai_summary or '', 'x_fc_engagement_findings': findings or '', }) + self._fc_post_engagement_notice(owner_name_clean, findings or '') + + def _fc_post_engagement_notice(self, owner_name, findings): + """Public chatter message posted when an engagement is sent. + + Two purposes: + - Tells the employee (via the entech My Tickets inbox, which only + reads public comments) that their request has been escalated + for approval and who's deciding. + - Captures our reply (findings) on the public thread so the + employee can see what support said — same content the owner + receives in the engagement email, just without the AI summary + (which is a decision-aid for the owner, not the employee). + + Posted via message_post with subtype_xmlid='mail.mt_comment' so + it survives the entech-side _public_messages filter + (message_type='comment' + non-internal subtype). + """ + from markupsafe import Markup, escape + self.ensure_one() + name_html = escape(owner_name or 'the owner') + body = ( + '

Awaiting owner approval from %s. ' + 'Their decision will appear here when they reply.

' + ) % name_html + text = (findings or '').strip() + if text: + body += ( + '

Our reply:

' + '
%s
' + ) % escape(text).replace('\n', '
') + self.message_post( + body=Markup(body), + message_type='comment', + subtype_xmlid='mail.mt_comment', + ) def action_add_owner_as_follower(self): """Find-or-create the owner partner and subscribe them as a follower