Add a "Past Retention" filter in samples listing#65
Conversation
Samples their storage expiry date have passed are displayed in the listing when "Past retention" button is clicked
ramonski
left a comment
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Hehe, a classic Jordi negated docstring 😄
What about global contacts? I guess they would be considered as lab users as well here.
There was a problem hiding this comment.
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.
Yes, for now, to reset the storage expiry date you have to recover and re-add. |
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.
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.