Skip to content

Commit

Permalink
primeng: acquistion
Browse files Browse the repository at this point in the history
Co-Authored-by: Johnny Mariéthoz <[email protected]>
Co-Authored-by: Pascal Repond <[email protected]>
  • Loading branch information
jma and PascalRepond committed Feb 12, 2025
1 parent c5f85be commit a8da8b7
Show file tree
Hide file tree
Showing 89 changed files with 814 additions and 714 deletions.
2 changes: 1 addition & 1 deletion Dockerfile.base
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ FROM python:3.9-slim-bullseye
# require debian packages
RUN apt-get update -y && apt-get upgrade -y
RUN apt-get install --no-install-recommends -y git vim-tiny curl gcc gnupg libc6-dev procps imagemagick && rm -rf /var/lib/apt/lists/*
RUN pip install --upgrade setuptools wheel pip poetry
RUN pip install --upgrade setuptools wheel pip poetry && poetry self add poetry-plugin-shell

# # uwsgi uwsgitop uwsgi-tools

Expand Down
5 changes: 4 additions & 1 deletion INSTALL.rst
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,10 @@ among other things.
$ pyenv install 3.9.7
$ cd rero-ils
$ pyenv local 3.9.7
$ sudo pip install poetry
$ curl -sSL https://install.python-poetry.org | python3 -
$ optional: poetry self add poetry-plugin-shell
See: https://python-poetry.org/docs#installation for more detail.

Next, ``cd`` into the project directory and bootstrap the instance (this will install
all Python dependencies and build all static assets):
Expand Down
37 changes: 9 additions & 28 deletions data/acq_order_lines.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"priority": 0,
"quantity": 3,
"amount": 25,
"exchange_rate": 1,
"notes": [
{
"type": "staff_note",
Expand All @@ -23,15 +22,13 @@
"library": {
"$ref": "https://bib.rero.ch/api/libraries/1"
},
"is_cancelled": false,
"send_now": true
"is_cancelled": false
},
{
"pid": "2",
"priority": 0,
"quantity": 15,
"amount": 5,
"exchange_rate": 1,
"notes": [
{
"type": "staff_note",
Expand All @@ -50,15 +47,13 @@
"library": {
"$ref": "https://bib.rero.ch/api/libraries/1"
},
"is_cancelled": false,
"send_now": true
"is_cancelled": false
},
{
"pid": "3",
"priority": 0,
"quantity": 2,
"amount": 100,
"exchange_rate": 1,
"notes": [
{
"type": "staff_note",
Expand All @@ -77,15 +72,13 @@
"library": {
"$ref": "https://bib.rero.ch/api/libraries/1"
},
"is_cancelled": false,
"send_now": true
"is_cancelled": false
},
{
"pid": "4",
"priority": 0,
"quantity": 5,
"amount": 10,
"exchange_rate": 1,
"acq_account": {
"$ref": "https://bib.rero.ch/api/acq_accounts/7"
},
Expand All @@ -98,15 +91,13 @@
"library": {
"$ref": "https://bib.rero.ch/api/libraries/2"
},
"is_cancelled": false,
"send_now": true
"is_cancelled": false
},
{
"pid": "5",
"priority": 5,
"quantity": 1,
"amount": 100,
"exchange_rate": 1,
"notes": [
{
"type": "staff_note",
Expand All @@ -125,15 +116,13 @@
"library": {
"$ref": "https://bib.rero.ch/api/libraries/2"
},
"is_cancelled": false,
"send_now": true
"is_cancelled": false
},
{
"pid": "6",
"priority": 1,
"quantity": 5,
"amount": 7,
"exchange_rate": 1,
"acq_account": {
"$ref": "https://bib.rero.ch/api/acq_accounts/14"
},
Expand All @@ -146,15 +135,13 @@
"library": {
"$ref": "https://bib.rero.ch/api/libraries/3"
},
"is_cancelled": false,
"send_now": true
"is_cancelled": false
},
{
"pid": "7",
"priority": 1,
"quantity": 15,
"amount": 12,
"exchange_rate": 1,
"acq_account": {
"$ref": "https://bib.rero.ch/api/acq_accounts/20"
},
Expand All @@ -167,15 +154,13 @@
"library": {
"$ref": "https://bib.rero.ch/api/libraries/4"
},
"is_cancelled": false,
"send_now": true
"is_cancelled": false
},
{
"pid": "8",
"priority": 1,
"quantity": 10,
"amount": 20,
"exchange_rate": 1,
"acq_account": {
"$ref": "https://bib.rero.ch/api/acq_accounts/4"
},
Expand All @@ -188,15 +173,13 @@
"library": {
"$ref": "https://bib.rero.ch/api/libraries/1"
},
"is_cancelled": false,
"send_now": true
"is_cancelled": false
},
{
"pid": "9",
"priority": 0,
"quantity": 3,
"amount": 22,
"exchange_rate": 1,
"acq_account": {
"$ref": "https://bib.rero.ch/api/acq_accounts/2"
},
Expand All @@ -216,7 +199,6 @@
"priority": 0,
"quantity": 3,
"amount": 25,
"exchange_rate": 1,
"notes": [
{
"type": "staff_note",
Expand All @@ -235,7 +217,6 @@
"library": {
"$ref": "https://bib.rero.ch/api/libraries/1"
},
"is_cancelled": false,
"order_date": "2021-07-20"
"is_cancelled": false
}
]
16 changes: 6 additions & 10 deletions data/acq_orders.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
{
"pid": "1",
"reference": "AOSTE-CANT1-POL-1",
"type": "monograph",
"currency": "EUR",
"notes": [
{
Expand All @@ -18,12 +17,12 @@
},
"organisation": {
"$ref": "https://bib.rero.ch/api/organisations/1"
}
},
"send_now": true
},
{
"pid": "2",
"reference": "AOSTE-CANT1-POL-2",
"type": "monograph",
"currency": "EUR",
"notes": [
{
Expand All @@ -39,12 +38,12 @@
},
"organisation": {
"$ref": "https://bib.rero.ch/api/organisations/1"
}
},
"send_now": true
},
{
"pid": "3",
"reference": "AOSTE-CANT2-POL-1",
"type": "monograph",
"currency": "EUR",
"notes": [
{
Expand All @@ -65,7 +64,6 @@
{
"pid": "4",
"reference": "AOSTE-AVISE-POL-1",
"type": "monograph",
"currency": "EUR",
"notes": [
{
Expand All @@ -86,7 +84,6 @@
{
"pid": "5",
"reference": "AOSTE-LYCEE-POL-1",
"type": "monograph",
"currency": "EUR",
"notes": [
{
Expand All @@ -107,7 +104,6 @@
{
"pid": "6",
"reference": "AOSTE-CANT1-POL-6",
"type": "monograph",
"currency": "EUR",
"library": {
"$ref": "https://bib.rero.ch/api/libraries/1"
Expand All @@ -122,7 +118,6 @@
{
"pid": "7",
"reference": "AOSTE-CANT1-POL-2021-1",
"type": "monograph",
"currency": "EUR",
"notes": [
{
Expand All @@ -138,6 +133,7 @@
},
"organisation": {
"$ref": "https://bib.rero.ch/api/organisations/1"
}
},
"send_now": true
}
]
2 changes: 0 additions & 2 deletions data/acq_receipts.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"$ref": "https://bib.rero.ch/api/acq_orders/1"
},
"reference": "AOSTE-CANT1-POL-1",
"exchange_rate": 1,
"notes": [
{
"type": "staff_note",
Expand All @@ -25,7 +24,6 @@
"$ref": "https://bib.rero.ch/api/acq_orders/7"
},
"reference": "AOSTE-CANT1-POL-2021-1",
"exchange_rate": 1,
"notes": [
{
"type": "staff_note",
Expand Down
10 changes: 5 additions & 5 deletions rero_ils/jsonschemas/common/identifier-v0.0.1.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
"widget": {
"formlyConfig": {
"props": {
"containerCssClass": "row",
"itemCssClass": "col-lg-12",
"containerCssClass": "grid grid-nogutter-y",
"itemCssClass": "col-12",
"hide": true
}
}
Expand All @@ -46,7 +46,7 @@
"widget": {
"formlyConfig": {
"props": {
"itemCssClass": "col-lg-6",
"itemCssClass": "col-12 md:col-6",
"options": [
{
"value": "bf:Local",
Expand Down Expand Up @@ -76,7 +76,7 @@
"widget": {
"formlyConfig": {
"props": {
"itemCssClass": "col-lg-6"
"itemCssClass": "col-12 md:col-6"
}
}
}
Expand All @@ -93,7 +93,7 @@
"hide": "field?.parent?.model?.type !== 'bf:Local'"
},
"props": {
"itemCssClass": "col-lg-6"
"itemCssClass": "col-12 md:col-6"
}
}
}
Expand Down
12 changes: 6 additions & 6 deletions rero_ils/jsonschemas/common/languages-v0.0.1.json
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@
"type": "select",
"props": {
"sort": true,
"itemCssClass": "col-lg-6",
"itemCssClass": "col-12 md:col-6",
"options": [
{
"label": "lang_aar",
Expand Down Expand Up @@ -2550,7 +2550,7 @@
"widget": {
"formlyConfig": {
"props": {
"itemCssClass": "col-lg-12",
"itemCssClass": "col-12",
"hide": true
}
}
Expand All @@ -2574,7 +2574,7 @@
"widget": {
"formlyConfig": {
"props": {
"itemCssClass": "col-lg-12"
"itemCssClass": "col-12"
}
}
}
Expand All @@ -2586,7 +2586,7 @@
"widget": {
"formlyConfig": {
"props": {
"containerCssClass": "row"
"containerCssClass": "grid grid-nogutter-y"
}
}
}
Expand All @@ -2610,7 +2610,7 @@
"formlyConfig": {
"focus": true,
"props": {
"itemCssClass": "col-lg-12"
"itemCssClass": "col-12"
}
}
}
Expand All @@ -2622,7 +2622,7 @@
"widget": {
"formlyConfig": {
"props": {
"containerCssClass": "row"
"containerCssClass": "grid grid-nogutter-y"
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion rero_ils/jsonschemas/common/ui-languages-v0.0.1.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"type": "select",
"props": {
"sort": true,
"itemCssClass": "col-lg-2",
"itemCssClass": "col-12 md:col-2",
"options": [
{
"label": "lang_fre",
Expand Down
9 changes: 9 additions & 0 deletions rero_ils/modules/acquisition/acq_accounts/serializers/json.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,15 @@
class AcqAccountJSONSerializer(ACQJSONSerializer):
"""Serializer for RERO-ILS `AcqAccount` records as JSON."""

def _postprocess_search_hit(self, hit: dict) -> None:
"""Post-process each hit of a search result."""
hit["metadata"]["number_of_children"] = (
AcqAccountsSearch()
.filter("term", parent__pid=hit["metadata"]["pid"])
.count()
)
super()._postprocess_search_hit(hit)

def preprocess_record(self, pid, record, links_factory=None, **kwargs):
"""Prepare a record and persistent identifier for serialization."""
# Add some ES stored keys into response
Expand Down
Loading

0 comments on commit a8da8b7

Please sign in to comment.