feat(fusion_helpdesk_central): Owner Contact field + Add-as-Follower button

Adds a one-click 'loop the owner into the chatter' shortcut on the
ticket form — separate from the engagement approval flow, just keeps
the owner in the loop on ongoing communication.

What's new on helpdesk.ticket:

- x_fc_owner_display (computed Char): 'Kris Pathinather <kris@…>',
  read live from fusion.helpdesk.client.key so a change to the owner
  contact reflects immediately on every existing ticket.
- x_fc_owner_email_resolved (computed Char): email-only slice, drives
  view visibility (the field + button only render when an owner is
  configured).
- x_fc_owner_is_follower (computed Boolean): True when a partner with
  the owner email is in message_partner_ids. Swaps the button for a
  green 'Following' badge when the owner is already on the thread.
- action_add_owner_as_follower(): find-or-create the owner partner by
  email and message_subscribe. Idempotent — second call is a no-op,
  no duplicate partner. Raises UserError with a clear message if no
  owner is configured.

View extension on the helpdesk ticket form: injects right after the
existing partner_id ('Customer') field in the customer side group,
so it reads as 'Customer | Owner Contact [Add as Follower]' — same
row, no layout shift when the state flips to 'Following'.

Tests cover the compute display in three states (configured,
no-client-label, no-owner-on-key), the action's three paths
(create-and-subscribe, reuse-existing-partner, idempotent-when-
already-following), and the UserError when nothing is configured.

Smoke-tested live on nexa: ticket with x_fc_client_label='ENTECH'
displays 'Kris Pathinather <kris@enplating.ca>'; first click adds
res.partner #723 to followers and flips owner_is_follower to True;
second click is a no-op.

Bumps fusion_helpdesk_central to 19.0.2.1.0.
This commit is contained in:
gsinghpal
2026-05-27 13:28:18 -04:00
parent 40b3205274
commit 8cc02759b8
4 changed files with 182 additions and 1 deletions

View File

@@ -74,6 +74,34 @@
statusbar_visible="pending,approved,rejected"/>
</xpath>
<!--
Owner Contact display + Add-as-Follower button in the
customer side group. Lives next to partner_id (the
"Customer" field) so it reads naturally as a second
contact slot. The button vanishes once the owner is
already following and a green "Following" badge takes
its place — same row, no layout shift.
-->
<xpath expr="//field[@name='partner_id']" position="after">
<field name="x_fc_owner_email_resolved" invisible="1"/>
<field name="x_fc_owner_is_follower" invisible="1"/>
<label for="x_fc_owner_display" string="Owner Contact"
invisible="not x_fc_owner_email_resolved"/>
<div class="o_row" invisible="not x_fc_owner_email_resolved">
<field name="x_fc_owner_display" nolabel="1" readonly="1"/>
<button name="action_add_owner_as_follower"
type="object"
string="Add as Follower"
icon="fa-user-plus"
class="btn-link"
invisible="x_fc_owner_is_follower"/>
<span invisible="not x_fc_owner_is_follower"
class="text-success ms-2">
<i class="fa fa-check-circle me-1"/>Following
</span>
</div>
</xpath>
<!-- Collapsible Owner Engagement page on the notebook. -->
<xpath expr="//notebook" position="inside">
<page string="Owner Engagement"