foliolib.folio.api.orders.Order
- class foliolib.folio.api.orders.Order(tenant: str, okapi: Optional[foliolib.okapi.okapiClient.OkapiClient] = None)
Bases:
foliolib.folio.FolioApiOrders Business Logic API
API for managing purchase orders
- Parameters
tenant (str) – Tenant id
okapi (OkapiClient, optional) – Instance of OkapiClient. Defaults to None.
Methods
delete_compositeOrder(compositeOrdersId)Delete a purchase order with given {id}
get_compositeOrder(compositeOrdersId)Return a purchase order with given {id}
get_compositeOrders(**kwargs)Retrieve a list of compositeOrder items.
modify_compositeOrder(compositeOrdersId, ...)Update a purchase order with given {id} - if request does not include po_lines or includes "po_lines": [] or "po_lines": null - update just purchase order summary - if request includes array of "po_lines" - update PO lines as per request
set_compositeOrder(compositeOrder)Post a purchase order (PO) and a number of PO lines; record fund transactions corresponding to the order.
set_reEncumber(compositeOrdersId)POST /orders/composite-orders/{compositeOrdersId}/re-encumber- delete_compositeOrder(compositeOrdersId: str)
Delete a purchase order with given {id}
DELETE /orders/composite-orders/{compositeOrdersId}- Parameters
compositeOrdersId (str) –
- Raises
OkapiRequestNotFound – Not Found
OkapiRequestError – Bad Request
OkapiFatalError – Server Error
- get_compositeOrder(compositeOrdersId: str)
Return a purchase order with given {id}
GET /orders/composite-orders/{compositeOrdersId}- Parameters
compositeOrdersId (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": "composite purchase order with dereferenced/expanded orders fields", "type": "object", "properties": { "id": { "description": "UUID of this purchase order", "type": "string", "$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", "$ref": "../../common/schemas/uuid.json" }, "billTo": { "description": "UUID of the billing address", "type": "string", "$ref": "../../common/schemas/uuid.json" }, "closeReason": { "description": "Close reason for purchase order. Some values are predefined and can trigger actions, such as Cancelled. See mod-orders-storage/src/main/resources/data/system/reasons-for-closure", "type": "object", "$ref": "../../mod-orders-storage/schemas/close_reason.json" }, "dateOrdered": { "description": "Date and time when purchase order was opened", "type": "string", "format": "date-time", "readonly": true }, "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": "../../mod-orders-storage/schemas/ongoing.json" }, "shipTo": { "description": "UUID of the shipping address", "type": "string", "$ref": "../../common/schemas/uuid.json" }, "template": { "description": "The ID of the order template used for this order. Applies to both PO and POL", "type": "string", "$ref": "../../common/schemas/uuid.json" }, "totalEstimatedPrice": { "description": "total estimated price of this purchase order", "type": "number" }, "totalEncumbered": { "description": "Total encumbered for the order", "type": "number", "readonly": true }, "totalExpended": { "description": "Total expended for the order", "type": "number", "readonly": true }, "totalItems": { "description": "total number of items included in the purchase order", "type": "integer" }, "vendor": { "description": "UUID of the vendorDetails record", "type": "string", "$ref": "../../common/schemas/uuid.json" }, "workflowStatus": { "description": "the workflow status for this purchase order", "type": "string", "$ref": "../../mod-orders-storage/schemas/workflow_status.json" }, "compositePoLines": { "description": "a list of completely de-referenced purchase order lines", "id": "compositePoLines", "type": "array", "items": { "type": "object", "$ref": "composite_po_line.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 }, "needReEncumber": { "description": "Indicates that order needs to be re-encumbered", "type": "boolean", "readonly": true } }, "additionalProperties": false, "required": [ "vendor", "orderType" ] }
- get_compositeOrders(**kwargs)
Retrieve a list of compositeOrder items.
GET /orders/composite-orders- Parameters
**kwargs (properties) – Keyword Arguments
- Keyword Arguments
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
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.
using CQL (indexes for purchase orders)
Example
(username==”ab*” or personal.firstName==”ab*” or personal.lastName==”ab*”) and active==”true” sortby personal.lastName personal.firstName barcode
workflow_status==”Pending”
- 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_compositeOrder(compositeOrdersId: str, compositeOrder: dict)
Update a purchase order with given {id} - if request does not include po_lines or includes “po_lines”: [] or “po_lines”: null - update just purchase order summary - if request includes array of “po_lines” - update PO lines as per request
PUT /orders/composite-orders/{compositeOrdersId}- Parameters
compositeOrdersId (str) –
compositeOrder (dict) – See Schema below
- Raises
OkapiRequestNotFound – Not Found
OkapiRequestError – Bad Request
OkapiFatalError – Server Error
Schema
{ "$schema": "http://json-schema.org/draft-04/schema#", "description": "composite purchase order with dereferenced/expanded orders fields", "type": "object", "properties": { "id": { "description": "UUID of this purchase order", "type": "string", "$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", "$ref": "../../common/schemas/uuid.json" }, "billTo": { "description": "UUID of the billing address", "type": "string", "$ref": "../../common/schemas/uuid.json" }, "closeReason": { "description": "Close reason for purchase order. Some values are predefined and can trigger actions, such as Cancelled. See mod-orders-storage/src/main/resources/data/system/reasons-for-closure", "type": "object", "$ref": "../../mod-orders-storage/schemas/close_reason.json" }, "dateOrdered": { "description": "Date and time when purchase order was opened", "type": "string", "format": "date-time", "readonly": true }, "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": "../../mod-orders-storage/schemas/ongoing.json" }, "shipTo": { "description": "UUID of the shipping address", "type": "string", "$ref": "../../common/schemas/uuid.json" }, "template": { "description": "The ID of the order template used for this order. Applies to both PO and POL", "type": "string", "$ref": "../../common/schemas/uuid.json" }, "totalEstimatedPrice": { "description": "total estimated price of this purchase order", "type": "number" }, "totalEncumbered": { "description": "Total encumbered for the order", "type": "number", "readonly": true }, "totalExpended": { "description": "Total expended for the order", "type": "number", "readonly": true }, "totalItems": { "description": "total number of items included in the purchase order", "type": "integer" }, "vendor": { "description": "UUID of the vendorDetails record", "type": "string", "$ref": "../../common/schemas/uuid.json" }, "workflowStatus": { "description": "the workflow status for this purchase order", "type": "string", "$ref": "../../mod-orders-storage/schemas/workflow_status.json" }, "compositePoLines": { "description": "a list of completely de-referenced purchase order lines", "id": "compositePoLines", "type": "array", "items": { "type": "object", "$ref": "composite_po_line.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 }, "needReEncumber": { "description": "Indicates that order needs to be re-encumbered", "type": "boolean", "readonly": true } }, "additionalProperties": false, "required": [ "vendor", "orderType" ] }
- set_compositeOrder(compositeOrder: dict)
Post a purchase order (PO) and a number of PO lines; record fund transactions corresponding to the order. Only in case an acquisition unit has to be assigned to the Order it is required that user should have extra permission orders.acquisitions-units-assignments.item.post to create an purchase order.
POST /orders/composite-orders- Parameters
compositeOrder (dict) – See Schema below
- Raises
OkapiRequestError – Bad Request
OkapiRequestUnauthorized – Authentication is required
OkapiFatalError – Server Error
Headers
Location - URI to the created compositeOrder item
Schema
{ "$schema": "http://json-schema.org/draft-04/schema#", "description": "composite purchase order with dereferenced/expanded orders fields", "type": "object", "properties": { "id": { "description": "UUID of this purchase order", "type": "string", "$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", "$ref": "../../common/schemas/uuid.json" }, "billTo": { "description": "UUID of the billing address", "type": "string", "$ref": "../../common/schemas/uuid.json" }, "closeReason": { "description": "Close reason for purchase order. Some values are predefined and can trigger actions, such as Cancelled. See mod-orders-storage/src/main/resources/data/system/reasons-for-closure", "type": "object", "$ref": "../../mod-orders-storage/schemas/close_reason.json" }, "dateOrdered": { "description": "Date and time when purchase order was opened", "type": "string", "format": "date-time", "readonly": true }, "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": "../../mod-orders-storage/schemas/ongoing.json" }, "shipTo": { "description": "UUID of the shipping address", "type": "string", "$ref": "../../common/schemas/uuid.json" }, "template": { "description": "The ID of the order template used for this order. Applies to both PO and POL", "type": "string", "$ref": "../../common/schemas/uuid.json" }, "totalEstimatedPrice": { "description": "total estimated price of this purchase order", "type": "number" }, "totalEncumbered": { "description": "Total encumbered for the order", "type": "number", "readonly": true }, "totalExpended": { "description": "Total expended for the order", "type": "number", "readonly": true }, "totalItems": { "description": "total number of items included in the purchase order", "type": "integer" }, "vendor": { "description": "UUID of the vendorDetails record", "type": "string", "$ref": "../../common/schemas/uuid.json" }, "workflowStatus": { "description": "the workflow status for this purchase order", "type": "string", "$ref": "../../mod-orders-storage/schemas/workflow_status.json" }, "compositePoLines": { "description": "a list of completely de-referenced purchase order lines", "id": "compositePoLines", "type": "array", "items": { "type": "object", "$ref": "composite_po_line.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 }, "needReEncumber": { "description": "Indicates that order needs to be re-encumbered", "type": "boolean", "readonly": true } }, "additionalProperties": false, "required": [ "vendor", "orderType" ] }
- set_reEncumber(compositeOrdersId: str)
POST /orders/composite-orders/{compositeOrdersId}/re-encumber- Parameters
compositeOrdersId (str) –
- Raises
OkapiRequestError – Bad Request
OkapiRequestNotFound – Not Found
OkapiFatalError – Server Error