From c7e975b0d23c3469350ee64899cd7ed27b40fbd1 Mon Sep 17 00:00:00 2001 From: Bertrand Zuchuat Date: Mon, 4 Dec 2023 09:32:04 +0100 Subject: [PATCH] item: add library name on the circulation dump Co-Authored-by: Bertrand Zuchuat --- rero_ils/modules/items/dumpers.py | 6 ++++++ tests/ui/items/test_items_dumpers.py | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/rero_ils/modules/items/dumpers.py b/rero_ils/modules/items/dumpers.py index 4244b86b4c..e3ba3db684 100644 --- a/rero_ils/modules/items/dumpers.py +++ b/rero_ils/modules/items/dumpers.py @@ -128,6 +128,12 @@ def dump(self, record, data): data['location']['organisation'] = { 'pid': record.organisation_pid } + + # add library and location name on same field (used for sorting) + library = location.get_library() + data['library_location_name'] = \ + f'{library["name"]}: {data["location"]["name"]}' + data['actions'] = list(record.actions) # only the first request is used by the UI diff --git a/tests/ui/items/test_items_dumpers.py b/tests/ui/items/test_items_dumpers.py index 271c128aa7..d999983f38 100644 --- a/tests/ui/items/test_items_dumpers.py +++ b/tests/ui/items/test_items_dumpers.py @@ -56,6 +56,10 @@ def test_item_action_circulation_dumper( # organisation pid assert data['location']['organisation']['pid'] + + # library and location name + assert data['library_location_name'] + # actions assert data['actions']