feat(fusion_portal): ADP/express->visit wiring, visit entry tile, email consolidation (live on westin 19.0.2.10.0)
- express save captures visit_id; visit-linked submit defers SO creation (saves draft + signature) and returns to the visit for grouping. - portal dashboard 'Start a Visit' tile for sales reps. - fix duplicate-authorizer completion email; visit grouped SOs email once per SO. - define visit._assessment_sale_type (ADP grouping key) - fixes AttributeError. Verified on a westin-v19 clone (load + ADP-grouping + combination-guard smoke test, mail neutralised) then deployed to westin prod 19.0.2.10.0. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1486,20 +1486,18 @@ class FusionAssessment(models.Model):
|
||||
})
|
||||
|
||||
def _send_completion_notifications(self):
|
||||
"""Send email notifications when assessment is completed"""
|
||||
"""Notify the CLIENT that the assessment is complete.
|
||||
|
||||
The authorizer, sales rep and office are already emailed (with the full
|
||||
assessment report) by ``_send_assessment_completed_email`` inside
|
||||
``_create_draft_sale_order``. This method used to ALSO send the
|
||||
authorizer a second, template-only email — that duplicate is removed;
|
||||
here we only notify the client.
|
||||
"""
|
||||
self.ensure_one()
|
||||
|
||||
# Send to authorizer
|
||||
if self.authorizer_id and self.authorizer_id.email:
|
||||
try:
|
||||
template = self.env.ref('fusion_portal.mail_template_assessment_complete_authorizer', raise_if_not_found=False)
|
||||
if template:
|
||||
template.send_mail(self.id, force_send=True)
|
||||
_logger.info(f"Sent assessment completion email to authorizer {self.authorizer_id.email}")
|
||||
except Exception as e:
|
||||
_logger.error(f"Failed to send authorizer notification: {e}")
|
||||
|
||||
# Send to client
|
||||
|
||||
# Send to client (authorizer/rep/office already emailed by
|
||||
# _send_assessment_completed_email in _create_draft_sale_order)
|
||||
if self.client_email:
|
||||
try:
|
||||
template = self.env.ref('fusion_portal.mail_template_assessment_complete_client', raise_if_not_found=False)
|
||||
|
||||
Reference in New Issue
Block a user