Skip to content

Fix profile services are not applied when creating samples programmatically#2736

Merged
xispa merged 3 commits into
2.xfrom
fix-profile-services-not-added-on-sample-creation
Jun 2, 2025
Merged

Fix profile services are not applied when creating samples programmatically#2736
xispa merged 3 commits into
2.xfrom
fix-profile-services-not-added-on-sample-creation

Conversation

@ramonski
Copy link
Copy Markdown
Contributor

@ramonski ramonski commented Jun 2, 2025

Description of the issue/feature this PR addresses

This PR fixes a side effect that was introduced in #2672

The problem arises if samples are created programmatically via the bika.lims.utils.analysisrequest.create_analysisrequest helper and not via the sample add form (where we already have these profile services extracted).

Current behavior before PR

Profile services are not added during sample creation if created programmatically.

Desired behavior after PR is merged

Profile services are added during sample creation if created programmatically.

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

@ramonski ramonski added Bug 🐞 Something is broken P1: Urgent ⏰ Address very soon labels Jun 2, 2025
@ramonski ramonski requested a review from xispa June 2, 2025 14:20
@Bugerman58
Copy link
Copy Markdown
Contributor

Bugerman58 commented Jun 2, 2025

Hi Ramon!

I encountered this in #2734 when I was researching about creating an the Sample outside of the add form(jsonapi example).
I think I'll add a check of the category by client after this merge.

@ramonski
Copy link
Copy Markdown
Contributor Author

ramonski commented Jun 2, 2025

Hi Ramon!

I encountered this in #2734 when I was researching about creating an the Sample outside of the add form(jsonapi example). I think I'll add a check of the category by client after this merge.

Hi Anton,

Yes, in fact I also encountered this error while working with the JSON API again.

Regarding #2734:
Phew, I can imagine that this one get's tricky when these analyses from restricted categories are added via profiles 😵‍💫

Copy link
Copy Markdown
Member

@xispa xispa left a comment

Choose a reason for hiding this comment

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

Thanks for this fix!

@xispa xispa merged commit 7ef6fb1 into 2.x Jun 2, 2025
2 checks passed
@xispa xispa deleted the fix-profile-services-not-added-on-sample-creation branch June 2, 2025 19:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug 🐞 Something is broken P1: Urgent ⏰ Address very soon

Development

Successfully merging this pull request may close these issues.

3 participants