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

request: sort alphabetically pickup location #1090

Merged
merged 1 commit into from
Jul 20, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions rero_ils/modules/documents/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,15 +222,18 @@ def item_library_pickup_locations(item):
Location.get_record_by_pid(loc_pid)
for loc_pid in location.restrict_pickup_to
]))
return pickup_locations
else:
org = Organisation.get_record_by_pid(location.organisation_pid)
# Get the pickup location from each library of the item organisation
# (removing possible None value)
return list(filter(None, [
pickup_locations = list(filter(None, [
Location.get_record_by_pid(library.get_pickup_location_pid())
for library in org.get_libraries()
]))
return sorted(
pickup_locations,
key=lambda location: location.get('pickup_name', location.get('code'))
)


@blueprint.app_template_filter()
Expand Down