Skip to content

Commit

Permalink
documents: fix bug when generating the big and small items
Browse files Browse the repository at this point in the history
* Fixes the error `KeyError: 'subtype'` generated at the creation
   of small and big item files.

Co-Authored-by: Aly Badr <[email protected]>
  • Loading branch information
Aly Badr committed Feb 25, 2021
1 parent 560a47a commit 8a98021
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions rero_ils/modules/items/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,10 @@ def generate(count, itemscount, missing):
for document_pid in bar:
holdings = [{}]
# we will not create holdings for ebook and journal documents
doc_type = Document.get_record_by_pid(document_pid).get('type')
is_book = doc_type[0]['main_type'] == 'docmaintype_book'
is_ebook = doc_type[0]['subtype'] == 'docsubtype_e-book'
if is_book and is_ebook:
continue
if doc_type[0]['main_type'] == 'docmaintype_serial':
doc_type = Document.get_record_by_pid(
document_pid).get('type')[0]
if doc_type.get('subtype') == 'docsubtype_e-book' \
or doc_type.get('main_type') == 'docmaintype_serial':
continue

if Document.get_record_by_pid(
Expand Down

0 comments on commit 8a98021

Please sign in to comment.