Skip to content

Commit

Permalink
acquisition: block updates for resources
Browse files Browse the repository at this point in the history
The execution of the rollover process controles the setting of the
budget field is_active. Once this field is disabled, no more updates
or deletions are possible for the all resources attached to this
budget.

* Adds acquisition fixtures for a rolled over year.
* Adds serializer for all acquisition order resources.
* Adds receipts and receipt_lines fixtures.
* Fixes reasons_not_to_delete for acquisition resources.
* Closes #2930.

Co-Authored-by: Aly Badr <[email protected]>
Co-Authored-by: Bertrand Zuchuat <[email protected]>
  • Loading branch information
Aly Badr and Garfield-fr committed Aug 16, 2022
1 parent cc8c750 commit 1c8455b
Show file tree
Hide file tree
Showing 54 changed files with 897 additions and 566 deletions.
158 changes: 158 additions & 0 deletions data/acq_accounts.json
Original file line number Diff line number Diff line change
Expand Up @@ -971,5 971,163 @@
"library": {
"$ref": "https://bib.rero.ch/api/libraries/23"
}
},
{
"pid": "71",
"name": "AOSTE-CANT1-2021-Collections",
"number": "AOSTE-CANT1.2021.Col.01.000",
"allocated_amount": 50000,
"encumbrance_exceedance": 5,
"expenditure_exceedance": 5,
"budget": {
"$ref": "https://bib.rero.ch/api/budgets/5"
},
"library": {
"$ref": "https://bib.rero.ch/api/libraries/1"
}
},
{
"pid": "72",
"name": "AOSTE-CANT1-2021-Religions",
"number": "AOSTE-CANT1.2021.Col.01.001",
"allocated_amount": 20000,
"encumbrance_exceedance": 5,
"expenditure_exceedance": 5,
"parent": {
"$ref": "https://bib.rero.ch/api/acq_accounts/71"
},
"budget": {
"$ref": "https://bib.rero.ch/api/budgets/5"
},
"library": {
"$ref": "https://bib.rero.ch/api/libraries/1"
}
},
{
"pid": "73",
"name": "AOSTE-CANT2-2021-Collections",
"number": "AOSTE-CANT2.2021.Col.01.000",
"allocated_amount": 50000,
"encumbrance_exceedance": 5,
"expenditure_exceedance": 5,
"budget": {
"$ref": "https://bib.rero.ch/api/budgets/5"
},
"library": {
"$ref": "https://bib.rero.ch/api/libraries/2"
}
},
{
"pid": "74",
"name": "AOSTE-CANT2-Religions",
"number": "AOSTE-CANT2.2021.Col.01.001",
"allocated_amount": 20000,
"encumbrance_exceedance": 5,
"expenditure_exceedance": 5,
"parent": {
"$ref": "https://bib.rero.ch/api/acq_accounts/73"
},
"budget": {
"$ref": "https://bib.rero.ch/api/budgets/5"
},
"library": {
"$ref": "https://bib.rero.ch/api/libraries/2"
}
},
{
"pid": "75",
"name": "AOSTE-AVISE-2021-Collections",
"number": "AOSTE-AVISE.2021.Col.01.000",
"allocated_amount": 50000,
"encumbrance_exceedance": 5,
"expenditure_exceedance": 5,
"budget": {
"$ref": "https://bib.rero.ch/api/budgets/5"
},
"library": {
"$ref": "https://bib.rero.ch/api/libraries/3"
}
},
{
"pid": "76",
"name": "AOSTE-AVISE-2021-Religions",
"number": "AOSTE-AVISE.2021.Col.01.001",
"allocated_amount": 20000,
"encumbrance_exceedance": 5,
"expenditure_exceedance": 5,
"parent": {
"$ref": "https://bib.rero.ch/api/acq_accounts/75"
},
"budget": {
"$ref": "https://bib.rero.ch/api/budgets/5"
},
"library": {
"$ref": "https://bib.rero.ch/api/libraries/3"
}
},
{
"pid": "77",
"name": "AOSTE-LYCEE-2021-Collections",
"number": "AOSTE-LYCEE.2021.Col.01.000",
"allocated_amount": 50000,
"encumbrance_exceedance": 5,
"expenditure_exceedance": 5,
"budget": {
"$ref": "https://bib.rero.ch/api/budgets/5"
},
"library": {
"$ref": "https://bib.rero.ch/api/libraries/4"
}
},
{
"pid": "78",
"name": "AOSTE-LYCEE-2021-Religions",
"number": "AOSTE-LYCEE.2021.Col.01.001",
"allocated_amount": 20000,
"encumbrance_exceedance": 5,
"expenditure_exceedance": 5,
"parent": {
"$ref": "https://bib.rero.ch/api/acq_accounts/77"
},
"budget": {
"$ref": "https://bib.rero.ch/api/budgets/5"
},
"library": {
"$ref": "https://bib.rero.ch/api/libraries/4"
}
},
{
"pid": "79",
"name": "AOSTE-LYCEE-2021-Newspapers",
"number": "AOSTE-LYCEE.2021.Per.02.001",
"allocated_amount": 20000,
"encumbrance_exceedance": 5,
"expenditure_exceedance": 5,
"parent": {
"$ref": "https://bib.rero.ch/api/acq_accounts/22"
},
"budget": {
"$ref": "https://bib.rero.ch/api/budgets/5"
},
"library": {
"$ref": "https://bib.rero.ch/api/libraries/4"
}
},
{
"pid": "80",
"name": "AOSTE-LYCEE-2021-Online references",
"number": "AOSTE-LYCEE.2021.Per.02.002",
"allocated_amount": 20000,
"encumbrance_exceedance": 5,
"expenditure_exceedance": 5,
"parent": {
"$ref": "https://bib.rero.ch/api/acq_accounts/79"
},
"budget": {
"$ref": "https://bib.rero.ch/api/budgets/5"
},
"library": {
"$ref": "https://bib.rero.ch/api/libraries/4"
}
}
]
27 changes: 27 additions & 0 deletions data/acq_order_lines.json
Original file line number Diff line number Diff line change
Expand Up @@ -210,5 210,32 @@
"$ref": "https://bib.rero.ch/api/libraries/1"
},
"is_cancelled": false
},
{
"pid": "10",
"priority": 0,
"quantity": 3,
"amount": 25,
"exchange_rate": 1,
"notes": [
{
"type": "staff_note",
"content": "see patron_request: 1"
}
],
"acq_account": {
"$ref": "https://bib.rero.ch/api/acq_accounts/72"
},
"acq_order": {
"$ref": "https://bib.rero.ch/api/acq_orders/7"
},
"document": {
"$ref": "https://bib.rero.ch/api/documents/15"
},
"library": {
"$ref": "https://bib.rero.ch/api/libraries/1"
},
"is_cancelled": false,
"order_date": "2021-07-20"
}
]
21 changes: 21 additions & 0 deletions data/acq_orders.json
Original file line number Diff line number Diff line change
Expand Up @@ -118,5 118,26 @@
"organisation": {
"$ref": "https://bib.rero.ch/api/organisations/1"
}
},
{
"pid": "7",
"reference": "AOSTE-CANT1-POL-2021-1",
"type": "monograph",
"currency": "EUR",
"notes": [
{
"type": "vendor_note",
"content": "ISBN 2021 9782915741800"
}
],
"library": {
"$ref": "https://bib.rero.ch/api/libraries/1"
},
"vendor": {
"$ref": "https://bib.rero.ch/api/vendors/7"
},
"organisation": {
"$ref": "https://bib.rero.ch/api/organisations/1"
}
}
]
18 changes: 18 additions & 0 deletions data/acq_receipt_lines.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 16,23 @@
"$ref": "https://bib.rero.ch/api/organisations/1"
},
"receive_now": true
},
{
"pid": "2",
"acq_receipt": {
"$ref": "https://bib.rero.ch/api/acq_receipts/2"
},
"acq_order_line": {
"$ref": "https://bib.rero.ch/api/acq_order_lines/10"
},
"quantity": 3,
"amount": 25,
"library": {
"$ref": "https://bib.rero.ch/api/libraries/1"
},
"organisation": {
"$ref": "https://bib.rero.ch/api/organisations/1"
},
"receive_now": true
}
]
22 changes: 21 additions & 1 deletion data/acq_receipts.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 18,25 @@
"organisation": {
"$ref": "https://bib.rero.ch/api/organisations/1"
}
},
{
"pid": "2",
"acq_order": {
"$ref": "https://bib.rero.ch/api/acq_orders/7"
},
"reference": "AOSTE-CANT1-POL-2021-1",
"exchange_rate": 1,
"notes": [
{
"type": "staff_note",
"content": "ISBN 2021 9782915741800"
}
],
"library": {
"$ref": "https://bib.rero.ch/api/libraries/1"
},
"organisation": {
"$ref": "https://bib.rero.ch/api/organisations/1"
}
}
]
]
10 changes: 10 additions & 0 deletions data/budgets.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 26,15 @@
"organisation": {
"$ref": "https://bib.rero.ch/api/organisations/4"
}
},
{
"pid": "5",
"is_active": false,
"name": "2021",
"start_date": "2021-01-01",
"end_date": "2021-12-31",
"organisation": {
"$ref": "https://bib.rero.ch/api/organisations/1"
}
}
]
18 changes: 13 additions & 5 deletions rero_ils/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -1411,10 1411,12 @@ def _(x):
search_type=None,
indexer_class='rero_ils.modules.budgets.api:BudgetsIndexer',
record_serializers={
'application/json': 'rero_ils.modules.serializers:json_v1_response'
'application/json': 'rero_ils.modules.serializers:json_v1_response',
'application/rero json': 'rero_ils.modules.budgets.serializers:json_budg_record'
},
record_serializers_aliases={
'json': 'application/json',
'rero': 'application/rero json',
},
search_serializers={
'application/json': 'rero_ils.modules.serializers:json_v1_search'
Expand Down Expand Up @@ -1449,10 1451,12 @@ def _(x):
search_type=None,
indexer_class='rero_ils.modules.acq_orders.api:AcqOrdersIndexer',
record_serializers={
'application/json': 'rero_ils.modules.serializers:json_v1_response'
'application/json': 'rero_ils.modules.serializers:json_v1_response',
'application/rero json': 'rero_ils.modules.acq_orders.serializers:json_acor_record'
},
record_serializers_aliases={
'json': 'application/json',
'rero': 'application/rero json',
},
search_serializers={
'application/json': 'rero_ils.modules.serializers:json_v1_search',
Expand Down Expand Up @@ -1490,10 1494,12 @@ def _(x):
indexer_class=('rero_ils.modules.acq_order_lines.api:'
'AcqOrderLinesIndexer'),
record_serializers={
'application/json': 'rero_ils.modules.serializers:json_v1_response'
'application/json': 'rero_ils.modules.serializers:json_v1_response',
'application/rero json': 'rero_ils.modules.acq_order_lines.serializers:json_acol_record'
},
record_serializers_aliases={
'json': 'application/json',
'rero': 'application/rero json',
},
search_serializers={
'application/json': 'rero_ils.modules.serializers:json_v1_search'
Expand Down Expand Up @@ -1570,7 1576,8 @@ def _(x):
search_type=None,
indexer_class='rero_ils.modules.acq_receipt_lines.api:AcqReceiptLinesIndexer',
record_serializers={
'application/json': 'rero_ils.modules.serializers:json_v1_response'
'application/json': 'rero_ils.modules.serializers:json_v1_response',
'application/rero json': 'rero_ils.modules.acq_receipt_lines.serializers:json_acrl_record'
},
record_serializers_aliases={
'json': 'application/json',
Expand Down Expand Up @@ -1614,7 1621,8 @@ def _(x):
search_type=None,
indexer_class='rero_ils.modules.acq_invoices.api:AcquisitionInvoicesIndexer',
record_serializers={
'application/json': 'rero_ils.modules.serializers:json_v1_response'
'application/json': 'rero_ils.modules.serializers:json_v1_response',
'application/rero json': 'rero_ils.modules.acq_invoices.serializers:json_acq_invoice_record'
},
record_serializers_aliases={
'json': 'application/json',
Expand Down
18 changes: 17 additions & 1 deletion rero_ils/manual_translations.txt
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 68,20 @@ _('Sign Up')

# Test alert message
_('This is a TEST VERSION.')
_('Go to the production site.')
_('Go to the production site.')

# Acquisitions status
_('approved')
_('cancelled')
_('ordered')
_('partially_received')
_('pending')
_('received')

# Acquisitions type
_('monograph')
_('serial')
_('standing_order')
_('monographic_set')
_('planned_order')
_('multi_volume')
Loading

0 comments on commit 1c8455b

Please sign in to comment.