NMRL-396 Search using Client not working in Add Analyses (Worksheet) #248
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The problem was that using the form id as the prefix in the criteria was making bika_listing to add
getClientTitle
as a filter_index, cause it was previously defined inself.columns
:https://github.com/naralabs/bika.lims/blob/92d95015beb4bd39df679a079bfbbe31a949cf60/bika/lims/browser/bika_listing.py#L673-L678
so an
And
clause was automatically added in accordance then:https://github.com/naralabs/bika.lims/blob/92d95015beb4bd39df679a079bfbbe31a949cf60/bika/lims/browser/bika_listing.py#L684-L696
This resulted in bika_listing generating an AdvancedQuery that included the
contentFilter
initially set inadd_analyses.py
:https://github.com/naralabs/bika.lims/blob/92d95015beb4bd39df679a079bfbbe31a949cf60/bika/lims/browser/worksheet/views/add_analyses.py#L130-L148
, but also with an
And
clause forgetClientTitle
:https://github.com/naralabs/bika.lims/blob/92d95015beb4bd39df679a079bfbbe31a949cf60/bika/lims/browser/bika_listing.py#L1087-L1102
The problem was that the value for
getClientTitle
was the UID actually, so the the query did not return any value (there was no Analysis in the catalog with a value forgetClientTitle
index equal to the uid passed in).This Pull Request is a quick fix. We should consider to refactor/revisit the filtering machinery used for bika_listing. Is sometimes very confusing and the chance of error is too high if the dev has no deep knowledge about its internals.