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