Skip to content

Commit

Permalink
serials: allow loading of serials on non-journal documents
Browse files Browse the repository at this point in the history
This commit allows:
* loading of holdings of type `serial` on any type of `document`
* loading of holdings of type `standard` of document of type `journal`
* loading of items of type `standard` on holdings of type `serial`

* Closes rero#1612

Co-Authored-by: Aly Badr <aly.badr@rero.ch>
  • Loading branch information
Aly Badr committed Jan 26, 2021
1 parent 3fb0cf4 commit f1ffaa2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
9 changes: 3 additions & 6 deletions rero_ils/modules/holdings/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,6 @@ def extended_validation(self, **kwargs):
frequency the next_expected_date should be given.
:return: False if
- document type is not journal and holding type is serial.
- document type is journal and holding type is not serial.
- document type is ebook and holding type is not electronic.
- document type is not ebook and holding type is electronic.
- holding type is serial and the next_expected_date
Expand All @@ -157,10 +155,9 @@ def extended_validation(self, **kwargs):
is_electronic = self.holdings_type == 'electronic'
is_issuance = \
document.get('issuance', {}).get('main_type') == 'rdami:1003'
if (is_serial and not is_issuance) \
or (document.harvested ^ is_electronic):
msg = _('Holding is not attached to the correct document type.'
' document: {pid}')
if (document.harvested ^ is_electronic):
msg = _('Electronic Holding is not attached to the correct \
document type. document: {pid}')
return _(msg.format(pid=document_pid))
# the enumeration and chronology optional fields are only allowed for
# serial holdings
Expand Down
2 changes: 0 additions & 2 deletions rero_ils/modules/items/api/record.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,6 @@ def extended_validation(self, **kwargs):
if not holding:
return _('Holding does not exist: {pid}.'.format(pid=holding_pid))
is_serial = holding.holdings_type == 'serial'
if is_serial and self.get('type') == 'standard':
return _('Standard item can not attached to a journal.')
issue = self.get('issue', {})
if issue and self.get('type') == 'standard':
return _('Standard item can not have a issue field.')
Expand Down

0 comments on commit f1ffaa2

Please sign in to comment.