This commit is contained in:
gsinghpal
2026-05-21 03:37:25 -04:00
parent b2f483d67c
commit 1314f4581d
47 changed files with 5730 additions and 177 deletions

View File

@@ -252,10 +252,23 @@ class FusionCpShipment(models.Model):
}
def _action_open_attachment(self, attachment):
"""Open an attachment PDF in the browser viewer (new tab)."""
"""Open an attachment for the operator.
Delegates to ir.attachment.action_fusion_preview when
fusion_pdf_preview is installed — PDFs render in the preview
dialog, anything else downloads. Falls back to the legacy
new-tab URL when the helper isn't available. See CLAUDE.md
"PDF Preview" for the contract.
"""
self.ensure_one()
if not attachment:
return False
if hasattr(attachment, 'action_fusion_preview'):
return attachment.action_fusion_preview(
title=attachment.name or 'Shipping Label',
model_name=self._name,
record_ids=self.id,
)
return {
'type': 'ir.actions.act_url',
'url': '/web/content/%s?download=false' % attachment.id,