Skip to content

Commit

Permalink
loans: fix automatic item assignment on pending loans
Browse files Browse the repository at this point in the history
Fixes problem when the checked-in item will be assigned to all
pending loans of its document. Fixed by adding the parameter
assign_item to all the ITEM_RETURNED transitions.

This PR needs any  invenio-circulation v.a21

* Fixes inveniosoftware/invenio-circulation#127.
* Removes the temporary transitions file used as a work around earlier.

Co-Authored-by: Aly Badr <aly.badr@rero.ch>
  • Loading branch information
Aly Badr authored and blankoworld committed Aug 13, 2020
1 parent c81cc66 commit a3f3f30
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 125 deletions.
19 changes: 13 additions & 6 deletions rero_ils/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,6 @@
from .modules.loans.api import Loan
from .modules.loans.permissions import can_list_loan_factory, \
can_read_loan_factory
from .modules.loans.transitions import ItemInTransitHouseToItemReturned, \
ItemOnLoanToItemReturned
from .modules.loans.utils import can_be_requested, get_default_loan_duration, \
get_extension_params, is_item_available_for_checkout, \
loan_build_document_ref, loan_build_item_ref, loan_build_patron_ref, \
Expand Down Expand Up @@ -1893,6 +1891,7 @@ def _(x):
dest='ITEM_ON_LOAN',
trigger='checkout',
transition=ToItemOnLoan,
assign_item=False
),
],
'PENDING': [
Expand Down Expand Up @@ -1920,17 +1919,25 @@ def _(x):
dict(dest='CANCELLED', trigger='cancel', transition=ToCancelled)
],
'ITEM_ON_LOAN': [
dict(dest='ITEM_RETURNED',
transition=ItemOnLoanToItemReturned, trigger='checkin'),
dict(
dest='ITEM_RETURNED',
transition=ItemOnLoanToItemReturned,
trigger='checkin',
assign_item=False
),
dict(dest='ITEM_IN_TRANSIT_TO_HOUSE',
transition=ItemOnLoanToItemInTransitHouse, trigger='checkin'),
dict(dest='ITEM_ON_LOAN', transition=ItemOnLoanToItemOnLoan,
trigger='extend'),
dict(dest='CANCELLED', trigger='cancel', transition=ToCancelled)
],
'ITEM_IN_TRANSIT_TO_HOUSE': [
dict(dest='ITEM_RETURNED',
transition=ItemInTransitHouseToItemReturned, trigger='receive'),
dict(
dest='ITEM_RETURNED',
transition=ItemInTransitHouseToItemReturned,
trigger='receive',
assign_item=False
),
dict(dest='CANCELLED', trigger='cancel', transition=ToCancelled)
],
'ITEM_RETURNED': [],
Expand Down
119 changes: 0 additions & 119 deletions rero_ils/modules/loans/transitions.py

This file was deleted.

0 comments on commit a3f3f30

Please sign in to comment.