invenio-app-ils 4.1.0__py2.py3-none-any.whl → 4.3.0__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- invenio_app_ils/__init__.py +1 -1
- invenio_app_ils/circulation/api.py +123 -26
- invenio_app_ils/circulation/config.py +14 -2
- invenio_app_ils/circulation/loaders/__init__.py +2 -0
- invenio_app_ils/circulation/loaders/schemas/json/loan_request.py +2 -1
- invenio_app_ils/circulation/loaders/schemas/json/loan_self_checkout.py +19 -0
- invenio_app_ils/circulation/notifications/messages.py +1 -0
- invenio_app_ils/circulation/serializers/__init__.py +1 -0
- invenio_app_ils/circulation/serializers/response.py +1 -0
- invenio_app_ils/circulation/templates/invenio_app_ils_circulation/notifications/self_checkout.html +19 -0
- invenio_app_ils/circulation/views.py +100 -12
- invenio_app_ils/documents/jsonresolvers/document_stock.py +1 -1
- invenio_app_ils/documents/loaders/jsonschemas/document.py +1 -1
- invenio_app_ils/eitems/loaders/jsonschemas/eitems.py +1 -1
- invenio_app_ils/errors.py +103 -4
- invenio_app_ils/items/api.py +13 -1
- invenio_app_ils/items/loaders/jsonschemas/items.py +1 -1
- invenio_app_ils/items/search.py +13 -0
- invenio_app_ils/items/serializers/item.py +4 -4
- invenio_app_ils/patrons/anonymization.py +39 -9
- invenio_app_ils/permissions.py +49 -36
- invenio_app_ils/records/views.py +1 -1
- invenio_app_ils/records_relations/api.py +1 -0
- invenio_app_ils/relations/api.py +6 -1
- invenio_app_ils/series/loaders/jsonschemas/series.py +1 -1
- {invenio_app_ils-4.1.0.dist-info → invenio_app_ils-4.3.0.dist-info}/METADATA +16 -5
- {invenio_app_ils-4.1.0.dist-info → invenio_app_ils-4.3.0.dist-info}/RECORD +35 -34
- {invenio_app_ils-4.1.0.dist-info → invenio_app_ils-4.3.0.dist-info}/WHEEL +1 -1
- {invenio_app_ils-4.1.0.dist-info → invenio_app_ils-4.3.0.dist-info}/entry_points.txt +0 -1
- tests/api/circulation/test_loan_checkout.py +171 -66
- tests/api/ils/items/test_items_crud.py +46 -4
- tests/data/items.json +49 -27
- tests/api/ils/items/test_items_update.py +0 -40
- {invenio_app_ils-4.1.0.dist-info → invenio_app_ils-4.3.0.dist-info}/AUTHORS.rst +0 -0
- {invenio_app_ils-4.1.0.dist-info → invenio_app_ils-4.3.0.dist-info}/LICENSE +0 -0
- {invenio_app_ils-4.1.0.dist-info → invenio_app_ils-4.3.0.dist-info}/top_level.txt +0 -0
tests/data/items.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
[
|
|
2
2
|
{
|
|
3
3
|
"pid": "itemid-1",
|
|
4
|
-
"created_by": {"type": "script", "value": "demo"},
|
|
4
|
+
"created_by": { "type": "script", "value": "demo" },
|
|
5
5
|
"barcode": "123456789-1",
|
|
6
6
|
"document_pid": "docid-1",
|
|
7
7
|
"internal_location_pid": "ilocid-1",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
},
|
|
13
13
|
{
|
|
14
14
|
"pid": "itemid-2",
|
|
15
|
-
"created_by": {"type": "script", "value": "demo"},
|
|
15
|
+
"created_by": { "type": "script", "value": "demo" },
|
|
16
16
|
"barcode": "123456789-2",
|
|
17
17
|
"document_pid": "docid-1",
|
|
18
18
|
"internal_location_pid": "ilocid-2",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
},
|
|
24
24
|
{
|
|
25
25
|
"pid": "itemid-3",
|
|
26
|
-
"created_by": {"type": "script", "value": "demo"},
|
|
26
|
+
"created_by": { "type": "script", "value": "demo" },
|
|
27
27
|
"barcode": "123456789-3",
|
|
28
28
|
"document_pid": "docid-2",
|
|
29
29
|
"internal_location_pid": "ilocid-1",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
},
|
|
35
35
|
{
|
|
36
36
|
"pid": "itemid-4",
|
|
37
|
-
"created_by": {"type": "script", "value": "demo"},
|
|
37
|
+
"created_by": { "type": "script", "value": "demo" },
|
|
38
38
|
"barcode": "123456789-4",
|
|
39
39
|
"document_pid": "docid-3",
|
|
40
40
|
"internal_location_pid": "ilocid-2",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
},
|
|
46
46
|
{
|
|
47
47
|
"pid": "itemid-5",
|
|
48
|
-
"created_by": {"type": "script", "value": "demo"},
|
|
48
|
+
"created_by": { "type": "script", "value": "demo" },
|
|
49
49
|
"barcode": "123456789-5",
|
|
50
50
|
"document_pid": "docid-3",
|
|
51
51
|
"internal_location_pid": "ilocid-1",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
},
|
|
57
57
|
{
|
|
58
58
|
"pid": "itemid-6",
|
|
59
|
-
"created_by": {"type": "script", "value": "demo"},
|
|
59
|
+
"created_by": { "type": "script", "value": "demo" },
|
|
60
60
|
"barcode": "123456789-6",
|
|
61
61
|
"document_pid": "docid-3",
|
|
62
62
|
"internal_location_pid": "ilocid-1",
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
},
|
|
68
68
|
{
|
|
69
69
|
"pid": "itemid-7",
|
|
70
|
-
"created_by": {"type": "script", "value": "demo"},
|
|
70
|
+
"created_by": { "type": "script", "value": "demo" },
|
|
71
71
|
"barcode": "123456789-7",
|
|
72
72
|
"document_pid": "docid-5",
|
|
73
73
|
"internal_location_pid": "ilocid-2",
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
},
|
|
79
79
|
{
|
|
80
80
|
"pid": "itemid-8",
|
|
81
|
-
"created_by": {"type": "script", "value": "demo"},
|
|
81
|
+
"created_by": { "type": "script", "value": "demo" },
|
|
82
82
|
"barcode": "123456789-8",
|
|
83
83
|
"document_pid": "docid-5",
|
|
84
84
|
"internal_location_pid": "ilocid-1",
|
|
@@ -89,7 +89,7 @@
|
|
|
89
89
|
},
|
|
90
90
|
{
|
|
91
91
|
"pid": "itemid-9",
|
|
92
|
-
"created_by": {"type": "script", "value": "demo"},
|
|
92
|
+
"created_by": { "type": "script", "value": "demo" },
|
|
93
93
|
"barcode": "123456789-9",
|
|
94
94
|
"document_pid": "docid-5",
|
|
95
95
|
"internal_location_pid": "ilocid-1",
|
|
@@ -100,7 +100,7 @@
|
|
|
100
100
|
},
|
|
101
101
|
{
|
|
102
102
|
"pid": "itemid-10",
|
|
103
|
-
"created_by": {"type": "script", "value": "demo"},
|
|
103
|
+
"created_by": { "type": "script", "value": "demo" },
|
|
104
104
|
"barcode": "123456789-10",
|
|
105
105
|
"document_pid": "docid-5",
|
|
106
106
|
"internal_location_pid": "ilocid-1",
|
|
@@ -111,7 +111,7 @@
|
|
|
111
111
|
},
|
|
112
112
|
{
|
|
113
113
|
"pid": "itemid-50",
|
|
114
|
-
"created_by": {"type": "script", "value": "demo"},
|
|
114
|
+
"created_by": { "type": "script", "value": "demo" },
|
|
115
115
|
"barcode": "123456789-50",
|
|
116
116
|
"document_pid": "docid-5",
|
|
117
117
|
"internal_location_pid": "ilocid-1",
|
|
@@ -123,7 +123,7 @@
|
|
|
123
123
|
},
|
|
124
124
|
{
|
|
125
125
|
"pid": "itemid-51",
|
|
126
|
-
"created_by": {"type": "script", "value": "demo"},
|
|
126
|
+
"created_by": { "type": "script", "value": "demo" },
|
|
127
127
|
"barcode": "123456789-51",
|
|
128
128
|
"document_pid": "docid-5",
|
|
129
129
|
"internal_location_pid": "ilocid-2",
|
|
@@ -135,7 +135,7 @@
|
|
|
135
135
|
},
|
|
136
136
|
{
|
|
137
137
|
"pid": "itemid-52",
|
|
138
|
-
"created_by": {"type": "script", "value": "demo"},
|
|
138
|
+
"created_by": { "type": "script", "value": "demo" },
|
|
139
139
|
"barcode": "123456789-52",
|
|
140
140
|
"document_pid": "docid-5",
|
|
141
141
|
"internal_location_pid": "ilocid-1",
|
|
@@ -147,7 +147,7 @@
|
|
|
147
147
|
},
|
|
148
148
|
{
|
|
149
149
|
"pid": "itemid-53",
|
|
150
|
-
"created_by": {"type": "script", "value": "demo"},
|
|
150
|
+
"created_by": { "type": "script", "value": "demo" },
|
|
151
151
|
"barcode": "123456789-53",
|
|
152
152
|
"document_pid": "docid-5",
|
|
153
153
|
"internal_location_pid": "ilocid-1",
|
|
@@ -159,7 +159,7 @@
|
|
|
159
159
|
},
|
|
160
160
|
{
|
|
161
161
|
"pid": "itemid-54",
|
|
162
|
-
"created_by": {"type": "script", "value": "demo"},
|
|
162
|
+
"created_by": { "type": "script", "value": "demo" },
|
|
163
163
|
"barcode": "123456789-54",
|
|
164
164
|
"document_pid": "docid-5",
|
|
165
165
|
"internal_location_pid": "ilocid-1",
|
|
@@ -171,7 +171,7 @@
|
|
|
171
171
|
},
|
|
172
172
|
{
|
|
173
173
|
"pid": "itemid-55",
|
|
174
|
-
"created_by": {"type": "script", "value": "demo"},
|
|
174
|
+
"created_by": { "type": "script", "value": "demo" },
|
|
175
175
|
"barcode": "123456789-55",
|
|
176
176
|
"document_pid": "docid-1",
|
|
177
177
|
"internal_location_pid": "ilocid-1",
|
|
@@ -182,7 +182,7 @@
|
|
|
182
182
|
},
|
|
183
183
|
{
|
|
184
184
|
"pid": "itemid-56",
|
|
185
|
-
"created_by": {"type": "script", "value": "demo"},
|
|
185
|
+
"created_by": { "type": "script", "value": "demo" },
|
|
186
186
|
"barcode": "123456789-54",
|
|
187
187
|
"document_pid": "docid-5",
|
|
188
188
|
"internal_location_pid": "ilocid-1",
|
|
@@ -193,7 +193,7 @@
|
|
|
193
193
|
},
|
|
194
194
|
{
|
|
195
195
|
"pid": "itemid-57",
|
|
196
|
-
"created_by": {"type": "script", "value": "demo"},
|
|
196
|
+
"created_by": { "type": "script", "value": "demo" },
|
|
197
197
|
"barcode": "123456789-55",
|
|
198
198
|
"document_pid": "docid-1",
|
|
199
199
|
"internal_location_pid": "ilocid-1",
|
|
@@ -204,7 +204,7 @@
|
|
|
204
204
|
},
|
|
205
205
|
{
|
|
206
206
|
"pid": "itemid-MISSING",
|
|
207
|
-
"created_by": {"type": "script", "value": "demo"},
|
|
207
|
+
"created_by": { "type": "script", "value": "demo" },
|
|
208
208
|
"barcode": "123456789-55",
|
|
209
209
|
"document_pid": "docid-1",
|
|
210
210
|
"internal_location_pid": "ilocid-1",
|
|
@@ -215,8 +215,8 @@
|
|
|
215
215
|
},
|
|
216
216
|
{
|
|
217
217
|
"pid": "itemid-60",
|
|
218
|
-
"created_by": {"type": "script", "value": "demo"},
|
|
219
|
-
"barcode": "123456789-
|
|
218
|
+
"created_by": { "type": "script", "value": "demo" },
|
|
219
|
+
"barcode": "123456789-60",
|
|
220
220
|
"document_pid": "docid-1",
|
|
221
221
|
"internal_location_pid": "ilocid-1",
|
|
222
222
|
"circulation_restriction": "NO_RESTRICTION",
|
|
@@ -226,8 +226,8 @@
|
|
|
226
226
|
},
|
|
227
227
|
{
|
|
228
228
|
"pid": "itemid-61",
|
|
229
|
-
"created_by": {"type": "script", "value": "demo"},
|
|
230
|
-
"barcode": "123456789-
|
|
229
|
+
"created_by": { "type": "script", "value": "demo" },
|
|
230
|
+
"barcode": "123456789-61",
|
|
231
231
|
"document_pid": "docid-1",
|
|
232
232
|
"internal_location_pid": "ilocid-1",
|
|
233
233
|
"circulation_restriction": "NO_RESTRICTION",
|
|
@@ -237,7 +237,7 @@
|
|
|
237
237
|
},
|
|
238
238
|
{
|
|
239
239
|
"pid": "itemid-62",
|
|
240
|
-
"created_by": {"type": "script", "value": "demo"},
|
|
240
|
+
"created_by": { "type": "script", "value": "demo" },
|
|
241
241
|
"barcode": "123456789-55",
|
|
242
242
|
"document_pid": "docid-1",
|
|
243
243
|
"internal_location_pid": "ilocid-1",
|
|
@@ -248,7 +248,7 @@
|
|
|
248
248
|
},
|
|
249
249
|
{
|
|
250
250
|
"pid": "itemid-63",
|
|
251
|
-
"created_by": {"type": "script", "value": "demo"},
|
|
251
|
+
"created_by": { "type": "script", "value": "demo" },
|
|
252
252
|
"barcode": "123456789-55",
|
|
253
253
|
"document_pid": "docid-1",
|
|
254
254
|
"internal_location_pid": "ilocid-1",
|
|
@@ -259,13 +259,35 @@
|
|
|
259
259
|
},
|
|
260
260
|
{
|
|
261
261
|
"pid": "itemid-71",
|
|
262
|
-
"created_by": {"type": "script", "value": "demo"},
|
|
262
|
+
"created_by": { "type": "script", "value": "demo" },
|
|
263
263
|
"barcode": "123456789-55",
|
|
264
|
-
"document_pid": "docid-
|
|
264
|
+
"document_pid": "docid-15",
|
|
265
265
|
"internal_location_pid": "ilocid-4",
|
|
266
266
|
"circulation_restriction": "NO_RESTRICTION",
|
|
267
267
|
"medium": "NOT_SPECIFIED",
|
|
268
268
|
"status": "CAN_CIRCULATE",
|
|
269
269
|
"document": {}
|
|
270
|
+
},
|
|
271
|
+
{
|
|
272
|
+
"pid": "itemid-72",
|
|
273
|
+
"created_by": { "type": "script", "value": "demo" },
|
|
274
|
+
"barcode": "123456789-72",
|
|
275
|
+
"document_pid": "docid-16",
|
|
276
|
+
"internal_location_pid": "ilocid-1",
|
|
277
|
+
"circulation_restriction": "NO_RESTRICTION",
|
|
278
|
+
"medium": "NOT_SPECIFIED",
|
|
279
|
+
"status": "CAN_CIRCULATE",
|
|
280
|
+
"document": {}
|
|
281
|
+
},
|
|
282
|
+
{
|
|
283
|
+
"pid": "itemid-73",
|
|
284
|
+
"created_by": { "type": "script", "value": "demo" },
|
|
285
|
+
"barcode": "123456789-73",
|
|
286
|
+
"document_pid": "docid-17",
|
|
287
|
+
"internal_location_pid": "ilocid-1",
|
|
288
|
+
"circulation_restriction": "NO_RESTRICTION",
|
|
289
|
+
"medium": "NOT_SPECIFIED",
|
|
290
|
+
"status": "CAN_CIRCULATE",
|
|
291
|
+
"document": {}
|
|
270
292
|
}
|
|
271
293
|
]
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
#
|
|
3
|
-
# Copyright (C) 2018-2020 CERN.
|
|
4
|
-
#
|
|
5
|
-
# invenio-app-ils is free software; you can redistribute it and/or modify it
|
|
6
|
-
# under the terms of the MIT License; see LICENSE file for more details.
|
|
7
|
-
|
|
8
|
-
"""Test record delete."""
|
|
9
|
-
|
|
10
|
-
import pytest
|
|
11
|
-
|
|
12
|
-
from invenio_app_ils.circulation.search import get_active_loan_by_item_pid
|
|
13
|
-
from invenio_app_ils.errors import DocumentNotFoundError, ItemHasPastLoansError
|
|
14
|
-
from invenio_app_ils.items.api import ITEM_PID_TYPE, Item
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
def test_update_item(db, testdata):
|
|
18
|
-
"""Test update item status."""
|
|
19
|
-
|
|
20
|
-
def get_active_loan_pid_and_item_pid():
|
|
21
|
-
for t in testdata["items"]:
|
|
22
|
-
if t["status"] == "CAN_CIRCULATE":
|
|
23
|
-
item_pid = dict(type=ITEM_PID_TYPE, value=t["pid"])
|
|
24
|
-
active_loan = get_active_loan_by_item_pid(item_pid).execute().hits
|
|
25
|
-
total = active_loan.total.value
|
|
26
|
-
if total > 0:
|
|
27
|
-
return t["pid"], active_loan[0]["pid"]
|
|
28
|
-
|
|
29
|
-
# change document pid while is on loan
|
|
30
|
-
item_pid, loan_pid = get_active_loan_pid_and_item_pid()
|
|
31
|
-
item = Item.get_record_by_pid(item_pid)
|
|
32
|
-
item["document_pid"] = "docid-1"
|
|
33
|
-
with pytest.raises(ItemHasPastLoansError):
|
|
34
|
-
item.commit()
|
|
35
|
-
|
|
36
|
-
# change document to one that does not exist
|
|
37
|
-
item = Item.get_record_by_pid("itemid-1")
|
|
38
|
-
item["document_pid"] = "not_found_doc"
|
|
39
|
-
with pytest.raises(DocumentNotFoundError):
|
|
40
|
-
item.commit()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|