Acquisitions¶
Reached as client.acq. Covers Alma's /acq/po-lines endpoints: retrieving and
updating a purchase order line, receiving an item against one, and cancelling it.
AlmaClientAcqNS
¶
Bases: BaseNamespace
Namespace for acquisitions functionality.
Available as client.acq. Every method here returns a Box by default;
pass model= a Pydantic model class to get a validated instance of that
model instead. See Responses for the details.
get_po_line
async
Alma: Get PO-Line
¶
get_po_line(
po_line_id: str, *, model: None = ...
) -> RESP_TYPE
Retrieve a single purchase order line.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
po_line_id
|
str
|
The PO line identifier, e.g. |
required |
model
|
Any
|
Optional Pydantic model class to validate the response into. |
None
|
Returns:
| Type | Description |
|---|---|
Any
|
The PO line record. |
Raises:
| Type | Description |
|---|---|
APIClientError
|
If the PO line does not exist or is not accessible. |
Examples:
update_po_line
async
Alma: Update PO-Line
¶
Update a purchase order line.
Alma replaces the whole PO line with the body supplied, so updated_po_line
should normally be a record fetched with
get_po_line and then modified,
not a partial object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
po_line_id
|
str
|
The PO line identifier, e.g. |
required |
updated_po_line
|
Body
|
The full, modified PO line record. Accepts a mapping or
any object implementing |
required |
update_inventory
|
bool
|
Whether Alma should propagate the change to the associated inventory (items and holdings). |
False
|
redistribute_funds
|
bool
|
Whether Alma should redistribute encumbrances across the fund distribution when the price or funds change. |
False
|
model
|
Any
|
Optional Pydantic model class to validate the response into. |
None
|
Returns:
| Type | Description |
|---|---|
Any
|
The updated PO line record as returned by Alma. |
Raises:
| Type | Description |
|---|---|
POUpdateFailedError
|
If Alma rejected the update (Alma code |
APIClientError
|
If the PO line does not exist or the body is invalid. |
Examples:
receive_existing_item
async
Alma: Receive an Existing Item
¶
Receive an item that already exists against a purchase order line.
This is the op=receive operation on a PO line item – it marks physical
material as arrived. The item must already exist in Alma; this method does
not create one.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
po_line_id
|
str
|
The PO line identifier, e.g. |
required |
item_pid
|
str
|
The process ID of the item being received. |
required |
receive_date
|
date | None
|
Date of receipt. Defaults to Alma's own default (now) when
omitted. Serialised as |
None
|
department
|
str | None
|
Code of the receiving department. |
None
|
department_library
|
str | None
|
Code of the library owning the receiving department. |
None
|
updated_item
|
Body | None
|
Optional item record to apply as part of receiving, for example to set a barcode or enumeration at the same time. An empty body is sent when omitted. |
None
|
model
|
Any
|
Optional Pydantic model class to validate the response into. |
None
|
Returns:
| Type | Description |
|---|---|
Any
|
The received item record. |
Raises:
| Type | Description |
|---|---|
APIClientError
|
If the PO line or item does not exist, or the department codes are not valid for this institution. |
Examples:
cancel_po_line
async
Alma: Cancel PO-Line
¶
cancel_po_line(
po_line_id: str,
reason_code: str,
*,
comment: str | None = None,
inform_vendor: bool = False,
override: bool = False,
bib_handling: Literal[
"retain", "delete", "suppress"
] = "retain",
) -> None
Cancel a purchase order line.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
po_line_id
|
str
|
The PO line identifier, e.g. |
required |
reason_code
|
str
|
Cancellation reason. Must be a code from the
|
required |
comment
|
str | None
|
Free-text note recorded against the cancellation. |
None
|
inform_vendor
|
bool
|
Whether Alma should notify the vendor. |
False
|
override
|
bool
|
Whether to override Alma's cancellation warnings, for example when the line has already been partly received. |
False
|
bib_handling
|
Literal['retain', 'delete', 'suppress']
|
What to do with the associated bibliographic record –
|
'retain'
|
Returns:
| Type | Description |
|---|---|
None
|
|
Raises:
| Type | Description |
|---|---|
APIClientError
|
If the PO line does not exist, the reason code is not
valid, or Alma refuses the cancellation and |
Examples: