Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NMRL-396 Search using Client not working in Add Analyses (Worksheet) #248

Merged
merged 2 commits into from
Sep 6, 2017

Conversation

xispa
Copy link
Member

@xispa xispa commented Sep 6, 2017

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 in self.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 in add_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 for getClientTitle:

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 for getClientTitle 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.

@xispa xispa requested a review from Espurna September 6, 2017 08:13
@Espurna Espurna merged commit 5757870 into wip Sep 6, 2017
@xispa xispa deleted the nmrl-396-search-client-add-analyses branch September 15, 2017 16:35
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