Skip to content

Commit

Permalink
circulation: fix loan after a checkin of a validated request
Browse files Browse the repository at this point in the history
* Closes rero#770

Co-Authored-by: Aly Badr <aly.badr@rero.ch>
  • Loading branch information
Aly Badr committed Feb 24, 2020
1 parent 30830df commit 2358d67
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions rero_ils/modules/items/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -817,7 +817,6 @@ def checkin(self, current_loan, **kwargs):
loan = current_circulation.circulation.trigger(
current_loan, **dict(kwargs, trigger='checkin')
)
actions = {LoanAction.CHECKIN: loan}
# if item is requested we will automatically:
# - cancel the checked-in loan if still active
# - validate the next request
Expand All @@ -826,7 +825,10 @@ def checkin(self, current_loan, **kwargs):
request = next(self.get_requests())
if loan.is_active:
item, cancel_action = self.cancel_loan(pid=loan.pid)
item, validate_action = self.validate_request(**request)
item, validate_item = self.validate_request(**request)
# return the validated loan instead of the checked-in loan
loan = validate_item[LoanAction.VALIDATE]
actions = {LoanAction.CHECKIN: loan}
return self, actions

def prior_checkout_actions(self, action_params):
Expand Down

0 comments on commit 2358d67

Please sign in to comment.