fix(fusion_helpdesk_central): engagement now posts public chatter for employee

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 <owner_name>.
  Their decision will appear here when they reply.

  Our reply:
  > <findings text>

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.
This commit is contained in:
gsinghpal
2026-05-27 15:31:58 -04:00
parent 32c7026558
commit fe98fadf61
2 changed files with 48 additions and 2 deletions

View File

@@ -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.',

View File

@@ -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 = (
'<p>⏳ <b>Awaiting owner approval from %s.</b> '
'Their decision will appear here when they reply.</p>'
) % name_html
text = (findings or '').strip()
if text:
body += (
'<p><b>Our reply:</b></p>'
'<blockquote style="margin:6px 0 0 0; padding:6px 12px; '
'border-left:3px solid #c7dcfa; color:#1e3a5f; '
'background:#f4f8ff;">%s</blockquote>'
) % escape(text).replace('\n', '<br/>')
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