diff --git a/rero_ils/modules/loans/dumpers.py b/rero_ils/modules/loans/dumpers.py index 7e85e6056a..00b0071c54 100644 --- a/rero_ils/modules/loans/dumpers.py +++ b/rero_ils/modules/loans/dumpers.py @@ -47,14 +47,16 @@ def dump(self, record, data): data['patron']['name'] = ', '.join(( ptrn_data.last_name, ptrn_data.first_name)) - # only for pending requests + # only for pending requests and item at desk if record.get('pickup_location_pid') \ - and record.get('state') == LoanState.PENDING: + and record.get('state') in [ + LoanState.PENDING, LoanState.ITEM_AT_DESK]: location = Location.get_record_by_pid( record.get('pickup_location_pid')) data['pickup_location'] = { 'name': location.get('name'), - 'library_name': location.get_library().get('name') + 'library_name': location.get_library().get('name'), + 'pickup_name': location.pickup_name } # Always add item destination readable information if item state is diff --git a/rero_ils/modules/locations/api.py b/rero_ils/modules/locations/api.py index 74687aa550..5b95afd7c1 100644 --- a/rero_ils/modules/locations/api.py +++ b/rero_ils/modules/locations/api.py @@ -211,6 +211,12 @@ def restrict_pickup_to(self): for restrict_pickup_to in self.get('restrict_pickup_to', []) ] + @property + def pickup_name(self): + """Get pickup name for location.""" + return self['pickup_name'] if 'pickup_name' in self \ + else f"{self.library['code']}: {self['name']}" + @classmethod def can_request(cls, record, **kwargs): """Check if a record can be requested regarding its location.