Skip to content

Fix accreditation body logo rendering after Laboratory DX migration#167

Open
ramonski wants to merge 1 commit into
2.xfrom
2.x-fix-accreditation-logo-dx
Open

Fix accreditation body logo rendering after Laboratory DX migration#167
ramonski wants to merge 1 commit into
2.xfrom
2.x-fix-accreditation-logo-dx

Conversation

@ramonski

Copy link
Copy Markdown
Contributor

Description of the issue/feature this PR addresses

senaite.core 2.7 migrated the Laboratory content type to Dexterity, so its accreditation body logo is now a plone.namedfile.NamedBlobImage instead of an Archetypes image. The sample info template still built the image src via accreditation_logo/absolute_url, which a NamedBlobImage does not provide.

Current behavior before PR

Rendering the default report (senaite.impress:Default.pt) for an accredited laboratory that has an accreditation logo uploaded raises:

Error: (<plone.namedfile.file.NamedBlobImage object ...>, 'absolute_url')
 - Expression: "accreditation_logo/absolute_url"
 - Filename:   senaite/impress/analysisrequest/templates/info.pt (line 90)

Desired behavior after PR is merged

The accreditation logo renders correctly. A new get_accreditation_logo_url helper on the report view serves the NamedBlobImage through the standard @@images view ({laboratory_url}/@@images/accreditation_body_logo), and info.pt uses it. The existing fallback to the bundled AccreditationBodyLogo.png is kept for laboratories without a custom logo.

--
I confirm I have tested this PR thoroughly and coded it according to PEP8
and Plone's Python styleguide standards.

senaite.core 2.7 migrated the Laboratory to Dexterity, so the accreditation
body logo is now a plone.namedfile NamedBlobImage instead of an Archetypes
image. The sample info template still resolved its URL via `absolute_url`,
which a NamedBlobImage does not provide, raising an error when rendering the
default report for an accredited laboratory with a logo.

Add a `get_accreditation_logo_url` helper that serves the logo through the
standard `@@images` view and use it in the info template, keeping the bundled
default image as fallback.
@ramonski ramonski requested a review from xispa June 22, 2026 09:41
@ramonski ramonski added the Bug 🐞 Something is broken label Jun 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug 🐞 Something is broken

Development

Successfully merging this pull request may close these issues.

1 participant