foliolib.folio.api.ordersStorage.PurchaseOrder
- class foliolib.folio.api.ordersStorage.PurchaseOrder(tenant: str, okapi: Optional[foliolib.okapi.okapiClient.OkapiClient] = None)
Bases:
foliolib.folio.FolioApiPurchase Order
This module implements the CRUD interface. This API is intended for internal use only. Please use the /orders/composite-orders API provided by mod-orders instead.
- Parameters
tenant (str) – Tenant id
okapi (OkapiClient, optional) – Instance of OkapiClient. Defaults to None.
Methods
delete_purchaseOrder(purchaseOrdersId)Delete purchaseOrder item with given {purchaseOrderId}
get_purchaseOrder(purchaseOrdersId)Retrieve purchaseOrder item with given {purchaseOrderId}
get_purchaseOrders(**kwargs)Get list of purchase orders
modify_purchaseOrder(purchaseOrdersId, ...)Update purchaseOrder item with given {purchaseOrderId}
set_purchaseOrder(purchaseOrder)Create a new purchaseOrder item.
- delete_purchaseOrder(purchaseOrdersId: str)
Delete purchaseOrder item with given {purchaseOrderId}
DELETE /orders-storage/purchase-orders/{purchaseOrdersId}- Parameters
purchaseOrdersId (str) –
- Raises
OkapiRequestNotFound – Not Found
OkapiRequestError – Bad Request
OkapiFatalError – Server Error
- get_purchaseOrder(purchaseOrdersId: str)
Retrieve purchaseOrder item with given {purchaseOrderId}
GET /orders-storage/purchase-orders/{purchaseOrdersId}- Parameters
purchaseOrdersId (str) –
- Returns
See Schema below
- Return type
dict
- Raises
OkapiRequestNotFound – Not Found
OkapiFatalError – Server Error
Schema
{ "$schema": "http://json-schema.org/draft-04/schema#", "description": "purchase order", "type": "object", "javaName": "PurchaseOrder", "extends": { "$ref": "../../common/schemas/entity.json" }, "properties": { "id": { "description": "UUID of this purchase order", "$ref": "../../common/schemas/uuid.json" }, "approved": { "description": "whether or not the purchase order has been approved", "type": "boolean", "default": false }, "approvedById": { "description": "UUID of the user approving the order", "type": "object", "$ref": "../../common/schemas/uuid.json" }, "approvalDate": { "description": "Date and time when purchase order was approved", "type": "string", "format": "date-time" }, "assignedTo": { "description": "UUID of the user this purchase order his assigned to", "type": "string", "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$" }, "billTo": { "description": "UUID of the billing address", "type": "string", "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$" }, "closeReason": { "description": "Close reason for purchase order", "type": "object", "$ref": "close_reason.json" }, "dateOrdered": { "description": "Date and time when purchase order was opened", "type": "string", "format": "date-time" }, "manualPo": { "description": "if true, order cannot be sent automatically, e.g. via EDI", "type": "boolean" }, "notes": { "description": "free-form notes associated with this purchase order", "id": "notes", "type": "array", "items": { "type": "string" } }, "poNumber": { "description": "A human readable ID assigned to this purchase order", "type": "string", "pattern": "^[a-zA-Z0-9]{1,22}$" }, "poNumberPrefix": { "description": "Purchase order number prefix", "type": "string" }, "poNumberSuffix": { "description": "Purchase order number suffix", "type": "string" }, "orderType": { "description": "the purchase order type", "type": "string", "enum": [ "One-Time", "Ongoing" ] }, "reEncumber": { "description": "indicates this purchase order should be re-encumbered each fiscal year. Only applies to ongoing orders", "type": "boolean", "default": false }, "ongoing": { "description": "Ongoing information associated with this order", "type": "object", "$ref": "ongoing.json" }, "shipTo": { "description": "UUID of the shipping address", "type": "string", "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$" }, "template": { "description": "The ID of the order template used for this order. Applies to both PO and POL", "type": "string", "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$" }, "vendor": { "description": "UUID of the vendor record", "type": "string", "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$" }, "workflowStatus": { "description": "the workflow status for this purchase order", "type": "string", "$ref": "workflow_status.json" }, "acqUnitIds": { "description": "acquisition unit ids associated with this purchase order", "type": "array", "items": { "$ref": "../../common/schemas/uuid.json" } }, "nextPolNumber": { "description": "Number that will be used next time a purchase order line is created", "type": "integer", "readonly": true }, "tags": { "type": "object", "description": "arbitrary tags associated with this purchase order", "$ref": "../../../raml-util/schemas/tags.schema" }, "metadata": { "type": "object", "$ref": "../../../raml-util/schemas/metadata.schema", "readonly": true } }, "additionalProperties": false }
- get_purchaseOrders(**kwargs)
Get list of purchase orders
GET /orders-storage/purchase-orders- Parameters
**kwargs (properties) – Keyword Arguments
- Keyword Arguments
query (str) –
A query expressed as a CQL string (see [dev.folio.org/reference/glossary#cql](https://dev.folio.org/reference/glossary#cql)) using valid searchable fields. The first example below shows the general form of a full CQL query, but those fields might not be relevant in this context.
with valid searchable fields: for example code
Example
(username==”ab*” or personal.firstName==”ab*” or personal.lastName==”ab*”) and active==”true” sortby personal.lastName personal.firstName barcode
[“code”, “MEDGRANT”, “=”]
totalRecords (str) –
(default=auto) How to calculate the totalRecords property. “exact” for the correct number, “estimated” for an estimation, “auto” to automatically select “exact” or “estimated”, “none” for suppressing the totalRecords property. For details see https://github.com/folio-org/raml-module-builder#estimated-totalrecords
Example
none
offset (int) –
(default=0) Skip over a number of elements by specifying an offset value for the query
Example
0
limit (int) –
(default=10) Limit the number of elements returned in the response
Example
10
- Returns
See Schema below
- Return type
dict
- Raises
OkapiRequestError – Bad Request
OkapiRequestUnauthorized – Authentication is required
OkapiFatalError – Server Error
Schema
{ "$schema": "http://json-schema.org/draft-04/schema#", "description": "collection of purchase order records", "type": "object", "properties": { "purchaseOrders": { "description": "collection of purchase order records", "type": "array", "id": "purchaseOrders", "items": { "type": "object", "$ref": "purchase_order.json" } }, "totalRecords": { "description": "The number of objects contained in this collection", "type": "integer" } }, "additionalProperties": false, "required": [ "purchaseOrders", "totalRecords" ] }
- modify_purchaseOrder(purchaseOrdersId: str, purchaseOrder: dict)
Update purchaseOrder item with given {purchaseOrderId}
PUT /orders-storage/purchase-orders/{purchaseOrdersId}- Parameters
purchaseOrdersId (str) –
purchaseOrder (dict) – See Schema below
- Raises
OkapiRequestNotFound – Not Found
OkapiRequestError – Bad Request
OkapiRequestConflict – Conflict
OkapiFatalError – Server Error
Schema
{ "$schema": "http://json-schema.org/draft-04/schema#", "description": "purchase order", "type": "object", "javaName": "PurchaseOrder", "extends": { "$ref": "../../common/schemas/entity.json" }, "properties": { "id": { "description": "UUID of this purchase order", "$ref": "../../common/schemas/uuid.json" }, "approved": { "description": "whether or not the purchase order has been approved", "type": "boolean", "default": false }, "approvedById": { "description": "UUID of the user approving the order", "type": "object", "$ref": "../../common/schemas/uuid.json" }, "approvalDate": { "description": "Date and time when purchase order was approved", "type": "string", "format": "date-time" }, "assignedTo": { "description": "UUID of the user this purchase order his assigned to", "type": "string", "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$" }, "billTo": { "description": "UUID of the billing address", "type": "string", "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$" }, "closeReason": { "description": "Close reason for purchase order", "type": "object", "$ref": "close_reason.json" }, "dateOrdered": { "description": "Date and time when purchase order was opened", "type": "string", "format": "date-time" }, "manualPo": { "description": "if true, order cannot be sent automatically, e.g. via EDI", "type": "boolean" }, "notes": { "description": "free-form notes associated with this purchase order", "id": "notes", "type": "array", "items": { "type": "string" } }, "poNumber": { "description": "A human readable ID assigned to this purchase order", "type": "string", "pattern": "^[a-zA-Z0-9]{1,22}$" }, "poNumberPrefix": { "description": "Purchase order number prefix", "type": "string" }, "poNumberSuffix": { "description": "Purchase order number suffix", "type": "string" }, "orderType": { "description": "the purchase order type", "type": "string", "enum": [ "One-Time", "Ongoing" ] }, "reEncumber": { "description": "indicates this purchase order should be re-encumbered each fiscal year. Only applies to ongoing orders", "type": "boolean", "default": false }, "ongoing": { "description": "Ongoing information associated with this order", "type": "object", "$ref": "ongoing.json" }, "shipTo": { "description": "UUID of the shipping address", "type": "string", "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$" }, "template": { "description": "The ID of the order template used for this order. Applies to both PO and POL", "type": "string", "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$" }, "vendor": { "description": "UUID of the vendor record", "type": "string", "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$" }, "workflowStatus": { "description": "the workflow status for this purchase order", "type": "string", "$ref": "workflow_status.json" }, "acqUnitIds": { "description": "acquisition unit ids associated with this purchase order", "type": "array", "items": { "$ref": "../../common/schemas/uuid.json" } }, "nextPolNumber": { "description": "Number that will be used next time a purchase order line is created", "type": "integer", "readonly": true }, "tags": { "type": "object", "description": "arbitrary tags associated with this purchase order", "$ref": "../../../raml-util/schemas/tags.schema" }, "metadata": { "type": "object", "$ref": "../../../raml-util/schemas/metadata.schema", "readonly": true } }, "additionalProperties": false }
- set_purchaseOrder(purchaseOrder: dict)
Create a new purchaseOrder item.
POST /orders-storage/purchase-orders- Parameters
purchaseOrder (dict) – See Schema below
- Raises
OkapiRequestError – Bad Request
OkapiRequestUnauthorized – Authentication is required
OkapiFatalError – Server Error
Headers
Location - URI to the created purchaseOrder item
Schema
{ "$schema": "http://json-schema.org/draft-04/schema#", "description": "purchase order", "type": "object", "javaName": "PurchaseOrder", "extends": { "$ref": "../../common/schemas/entity.json" }, "properties": { "id": { "description": "UUID of this purchase order", "$ref": "../../common/schemas/uuid.json" }, "approved": { "description": "whether or not the purchase order has been approved", "type": "boolean", "default": false }, "approvedById": { "description": "UUID of the user approving the order", "type": "object", "$ref": "../../common/schemas/uuid.json" }, "approvalDate": { "description": "Date and time when purchase order was approved", "type": "string", "format": "date-time" }, "assignedTo": { "description": "UUID of the user this purchase order his assigned to", "type": "string", "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$" }, "billTo": { "description": "UUID of the billing address", "type": "string", "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$" }, "closeReason": { "description": "Close reason for purchase order", "type": "object", "$ref": "close_reason.json" }, "dateOrdered": { "description": "Date and time when purchase order was opened", "type": "string", "format": "date-time" }, "manualPo": { "description": "if true, order cannot be sent automatically, e.g. via EDI", "type": "boolean" }, "notes": { "description": "free-form notes associated with this purchase order", "id": "notes", "type": "array", "items": { "type": "string" } }, "poNumber": { "description": "A human readable ID assigned to this purchase order", "type": "string", "pattern": "^[a-zA-Z0-9]{1,22}$" }, "poNumberPrefix": { "description": "Purchase order number prefix", "type": "string" }, "poNumberSuffix": { "description": "Purchase order number suffix", "type": "string" }, "orderType": { "description": "the purchase order type", "type": "string", "enum": [ "One-Time", "Ongoing" ] }, "reEncumber": { "description": "indicates this purchase order should be re-encumbered each fiscal year. Only applies to ongoing orders", "type": "boolean", "default": false }, "ongoing": { "description": "Ongoing information associated with this order", "type": "object", "$ref": "ongoing.json" }, "shipTo": { "description": "UUID of the shipping address", "type": "string", "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$" }, "template": { "description": "The ID of the order template used for this order. Applies to both PO and POL", "type": "string", "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$" }, "vendor": { "description": "UUID of the vendor record", "type": "string", "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$" }, "workflowStatus": { "description": "the workflow status for this purchase order", "type": "string", "$ref": "workflow_status.json" }, "acqUnitIds": { "description": "acquisition unit ids associated with this purchase order", "type": "array", "items": { "$ref": "../../common/schemas/uuid.json" } }, "nextPolNumber": { "description": "Number that will be used next time a purchase order line is created", "type": "integer", "readonly": true }, "tags": { "type": "object", "description": "arbitrary tags associated with this purchase order", "$ref": "../../../raml-util/schemas/tags.schema" }, "metadata": { "type": "object", "$ref": "../../../raml-util/schemas/metadata.schema", "readonly": true } }, "additionalProperties": false }