Skip to content

Add a "Past Retention" filter in samples listing#65

Merged
ramonski merged 5 commits into2.xfrom
past-retention
Mar 10, 2026
Merged

Add a "Past Retention" filter in samples listing#65
ramonski merged 5 commits into2.xfrom
past-retention

Conversation

@xispa
Copy link
Member

@xispa xispa commented Mar 7, 2026

Description of the issue/feature this PR addresses

This Pull Request adds a filter button "Past retention" in samples listing that, when clicked, only stored samples whose retention period has passed are displayed.

20260307072141

Current behavior before PR

There is no specific filter button to only display stored samples whose retention period has passed

Desired behavior after PR is merged

There is specific filter button to only display stored samples whose retention period has passed

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

xispa added 4 commits March 7, 2026 06:24
@xispa xispa marked this pull request as ready for review March 7, 2026 06:25
@xispa xispa requested a review from ramonski March 7, 2026 06:25
Copy link
Contributor

@ramonski ramonski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just a minor thing.

Just one question: Is there currently a way to set the storage expiry date for existing stored samples? Or do I have to recover and re-add them?

rs.setdefault("custom_transitions", []).append(info)

def is_lab_user(self):
"""Returns whether the current user is not from a client
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hehe, a classic Jordi negated docstring 😄
What about global contacts? I guess they would be considered as lab users as well here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, but I think it still works because get_current_client only returns a Client object if it is the parent of the contact, which is not the case for global contacts. That said, I agree checking the user is not the right approach. I think we should rely on a field-specific permission instead (e.g. senaite.storage: Field: View Sample Container). I'll address this in a follow-up PR, if you don't mind.

@xispa
Copy link
Member Author

xispa commented Mar 10, 2026

Looks good, just a minor thing.

Just one question: Is there currently a way to set the storage expiry date for existing stored samples? Or do I have to recover and re-add them?

Yes, for now, to reset the storage expiry date you have to recover and re-add.

@ramonski ramonski merged commit 7a6492a into 2.x Mar 10, 2026
2 checks passed
@ramonski ramonski deleted the past-retention branch March 10, 2026 08:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants