foliolib.folio.api.orders.OrderLines
- class foliolib.folio.api.orders.OrderLines(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_orderLine(orderLinesId)Delete a purchase order line with given {id}
get_orderLine(orderLinesId)Return a purchase order line with given {id}
get_orderLines(**kwargs)Retrieve a list of orderLine items.
modify_orderLine(orderLinesId, orderLine)Update a purchase order line with given {id}
modify_validate(validate)Validate is cost amount equals to sum of all fund distributions
set_orderLine(orderLine)Post a PO lines to corresponding PO
- delete_orderLine(orderLinesId: str)
Delete a purchase order line with given {id}
DELETE /orders/order-lines/{orderLinesId}- Parameters
orderLinesId (str) –
- Raises
OkapiRequestNotFound – Not Found
OkapiRequestError – Bad Request
OkapiFatalError – Server Error
- get_orderLine(orderLinesId: str)
Return a purchase order line with given {id}
GET /orders/order-lines/{orderLinesId}- Parameters
orderLinesId (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 line with dereferenced/expanded orders fields", "type": "object", "properties": { "id": { "description": "UUID identifying this purchase order line", "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}$" }, "edition": { "description": "edition of the material", "type": "string" }, "checkinItems": { "description": "if true this will toggle the Check-in workflow for details associated with this PO line", "type": "boolean", "default": false }, "instanceId": { "description": "UUID of the instance record this purchase order line is related 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}$" }, "agreementId": { "description": "UUID of the agreement this purchase order line is related 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}$" }, "acquisitionMethod": { "description": "UUID of the acquisition method for this purchase order line", "type": "string", "$ref": "../../common/schemas/uuid.json" }, "automaticExport": { "description": "if true then line will be marked as available to export in the EDIFACT format or other format", "type": "boolean", "default": false }, "alerts": { "description": "alerts associated with this purchase order line", "id": "alerts", "type": "array", "items": { "description": "an alert record", "type": "object", "$ref": "../../mod-orders-storage/schemas/alert.json" } }, "cancellationRestriction": { "description": "whether or not there are cancellation restrictions for this purchase order line", "type": "boolean" }, "cancellationRestrictionNote": { "description": "free-form notes related to cancellation restrictions", "type": "string" }, "claims": { "description": "claims associated with this purchase order line", "id": "claims", "type": "array", "items": { "description": "a claim record", "type": "object", "$ref": "../../mod-orders-storage/schemas/claim.json" } }, "collection": { "description": "whether or not this purchase order line is for a collection", "type": "boolean" }, "contributors": { "description": "list of contributors to the material", "id": "contributors", "type": "array", "items": { "type": "object", "$ref": "../../mod-orders-storage/schemas/contributor.json" } }, "cost": { "description": "cost details associated with this purchase order line", "type": "object", "$ref": "../../mod-orders-storage/schemas/cost.json" }, "description": { "description": "description of the material", "type": "string" }, "details": { "description": "details about this purchase order line", "type": "object", "$ref": "../../mod-orders-storage/schemas/details.json" }, "donor": { "description": "the donor contributing to this purchase order line", "type": "string" }, "eresource": { "description": "eresource-related details of this purchase order line", "type": "object", "$ref": "../../mod-orders-storage/schemas/eresource.json" }, "fundDistribution": { "description": "the UUIDs of the fund distribution records for this purchase order line", "id": "fundDistribution", "type": "array", "items": { "description": "a fund distribution record", "type": "object", "$ref": "../../mod-orders-storage/schemas/fund_distribution.json" } }, "isPackage": { "description": "Indicates that this POL is for a package", "type": "boolean", "default": false }, "locations": { "description": "a list of the location records for this purchase order line", "id": "locations", "type": "array", "items": { "description": "The location details", "type": "object", "$ref": "../../mod-orders-storage/schemas/location.json" } }, "lastEDIExportDate": { "description": "The last date when line was exported in the EDIFACT file", "type": "string", "format": "date-time" }, "orderFormat": { "description": "The purchase order line format", "type": "object", "$ref": "../../mod-orders-storage/schemas/order_format.json" }, "packagePoLineId": { "description": "UUID referencing the poLine that represents the package that this POLs title belongs to", "$ref": "../../common/schemas/uuid.json" }, "paymentStatus": { "description": "The purchase order line payment status", "type": "string", "$ref": "../../mod-orders-storage/schemas/payment_status.json" }, "physical": { "description": "details of this purchase order line relating to physical materials", "type": "object", "$ref": "../../mod-orders-storage/schemas/physical.json" }, "poLineDescription": { "description": "purchase order line description", "type": "string" }, "poLineNumber": { "description": "A human readable number assigned to this PO line", "type": "string", "pattern": "^[a-zA-Z0-9]{1,22}-[0-9]{1,3}$", "readonly": true }, "publicationDate": { "description": "date (year) of the material's publication", "type": "string" }, "publisher": { "description": "publisher of the material", "type": "string" }, "purchaseOrderId": { "description": "UUID of this parent purchase order", "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}$" }, "receiptDate": { "description": "date the purchase order line was received", "type": [ "null", "string" ], "format": "date-time" }, "receiptStatus": { "description": "The purchase order line receipt status", "type": "object", "$ref": "../../mod-orders-storage/schemas/receipt_status.json" }, "renewalNote": { "description": "Renewal note for this purchase order line", "type": "string" }, "reportingCodes": { "description": "a list of reporting codes associated with this purchase order line", "id": "reportingCodes", "type": "array", "items": { "type": "object", "$ref": "../../mod-orders-storage/schemas/reporting_code.json" } }, "requester": { "description": "who requested this purchase order line", "type": "string" }, "rush": { "description": "whether or not this is a rush order", "type": "boolean" }, "selector": { "description": "who selected this material", "type": "string" }, "source": { "description": "the source of this purchase order line", "type": "object", "$ref": "../../mod-orders-storage/schemas/source.json" }, "tags": { "description": "arbitrary tags associated with this purchase order line", "id": "tags", "type": "object", "$ref": "../../../raml-util/schemas/tags.schema" }, "titleOrPackage": { "description": "title of the material", "type": "string" }, "vendorDetail": { "description": "details related to the vendor of this purchase order line", "type": "object", "$ref": "../../mod-orders-storage/schemas/vendor_detail.json" }, "metadata": { "type": "object", "$ref": "../../../raml-util/schemas/metadata.schema", "readonly": true } }, "additionalProperties": false, "required": [ "acquisitionMethod", "cost", "orderFormat", "source", "titleOrPackage" ] }
- get_orderLines(**kwargs)
Retrieve a list of orderLine items.
GET /orders/order-lines- 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 PO lines)
Example
(username==”ab*” or personal.firstName==”ab*” or personal.lastName==”ab*”) and active==”true” sortby personal.lastName personal.firstName barcode
payment_status==”Cancelled”
- 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 line records", "type": "object", "properties": { "poLines": { "description": "collection of purchase order line records", "type": "array", "id": "poLines", "items": { "type": "object", "$ref": "po_line.json" } }, "totalRecords": { "description": "The number of objects contained in this collection", "type": "integer" } }, "additionalProperties": false, "required": [ "poLines", "totalRecords" ] }
- modify_orderLine(orderLinesId: str, orderLine: dict)
Update a purchase order line with given {id}
PUT /orders/order-lines/{orderLinesId}- Parameters
orderLinesId (str) –
orderLine (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 line with dereferenced/expanded orders fields", "type": "object", "properties": { "id": { "description": "UUID identifying this purchase order line", "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}$" }, "edition": { "description": "edition of the material", "type": "string" }, "checkinItems": { "description": "if true this will toggle the Check-in workflow for details associated with this PO line", "type": "boolean", "default": false }, "instanceId": { "description": "UUID of the instance record this purchase order line is related 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}$" }, "agreementId": { "description": "UUID of the agreement this purchase order line is related 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}$" }, "acquisitionMethod": { "description": "UUID of the acquisition method for this purchase order line", "type": "string", "$ref": "../../common/schemas/uuid.json" }, "automaticExport": { "description": "if true then line will be marked as available to export in the EDIFACT format or other format", "type": "boolean", "default": false }, "alerts": { "description": "alerts associated with this purchase order line", "id": "alerts", "type": "array", "items": { "description": "an alert record", "type": "object", "$ref": "../../mod-orders-storage/schemas/alert.json" } }, "cancellationRestriction": { "description": "whether or not there are cancellation restrictions for this purchase order line", "type": "boolean" }, "cancellationRestrictionNote": { "description": "free-form notes related to cancellation restrictions", "type": "string" }, "claims": { "description": "claims associated with this purchase order line", "id": "claims", "type": "array", "items": { "description": "a claim record", "type": "object", "$ref": "../../mod-orders-storage/schemas/claim.json" } }, "collection": { "description": "whether or not this purchase order line is for a collection", "type": "boolean" }, "contributors": { "description": "list of contributors to the material", "id": "contributors", "type": "array", "items": { "type": "object", "$ref": "../../mod-orders-storage/schemas/contributor.json" } }, "cost": { "description": "cost details associated with this purchase order line", "type": "object", "$ref": "../../mod-orders-storage/schemas/cost.json" }, "description": { "description": "description of the material", "type": "string" }, "details": { "description": "details about this purchase order line", "type": "object", "$ref": "../../mod-orders-storage/schemas/details.json" }, "donor": { "description": "the donor contributing to this purchase order line", "type": "string" }, "eresource": { "description": "eresource-related details of this purchase order line", "type": "object", "$ref": "../../mod-orders-storage/schemas/eresource.json" }, "fundDistribution": { "description": "the UUIDs of the fund distribution records for this purchase order line", "id": "fundDistribution", "type": "array", "items": { "description": "a fund distribution record", "type": "object", "$ref": "../../mod-orders-storage/schemas/fund_distribution.json" } }, "isPackage": { "description": "Indicates that this POL is for a package", "type": "boolean", "default": false }, "locations": { "description": "a list of the location records for this purchase order line", "id": "locations", "type": "array", "items": { "description": "The location details", "type": "object", "$ref": "../../mod-orders-storage/schemas/location.json" } }, "lastEDIExportDate": { "description": "The last date when line was exported in the EDIFACT file", "type": "string", "format": "date-time" }, "orderFormat": { "description": "The purchase order line format", "type": "object", "$ref": "../../mod-orders-storage/schemas/order_format.json" }, "packagePoLineId": { "description": "UUID referencing the poLine that represents the package that this POLs title belongs to", "$ref": "../../common/schemas/uuid.json" }, "paymentStatus": { "description": "The purchase order line payment status", "type": "string", "$ref": "../../mod-orders-storage/schemas/payment_status.json" }, "physical": { "description": "details of this purchase order line relating to physical materials", "type": "object", "$ref": "../../mod-orders-storage/schemas/physical.json" }, "poLineDescription": { "description": "purchase order line description", "type": "string" }, "poLineNumber": { "description": "A human readable number assigned to this PO line", "type": "string", "pattern": "^[a-zA-Z0-9]{1,22}-[0-9]{1,3}$", "readonly": true }, "publicationDate": { "description": "date (year) of the material's publication", "type": "string" }, "publisher": { "description": "publisher of the material", "type": "string" }, "purchaseOrderId": { "description": "UUID of this parent purchase order", "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}$" }, "receiptDate": { "description": "date the purchase order line was received", "type": [ "null", "string" ], "format": "date-time" }, "receiptStatus": { "description": "The purchase order line receipt status", "type": "object", "$ref": "../../mod-orders-storage/schemas/receipt_status.json" }, "renewalNote": { "description": "Renewal note for this purchase order line", "type": "string" }, "reportingCodes": { "description": "a list of reporting codes associated with this purchase order line", "id": "reportingCodes", "type": "array", "items": { "type": "object", "$ref": "../../mod-orders-storage/schemas/reporting_code.json" } }, "requester": { "description": "who requested this purchase order line", "type": "string" }, "rush": { "description": "whether or not this is a rush order", "type": "boolean" }, "selector": { "description": "who selected this material", "type": "string" }, "source": { "description": "the source of this purchase order line", "type": "object", "$ref": "../../mod-orders-storage/schemas/source.json" }, "tags": { "description": "arbitrary tags associated with this purchase order line", "id": "tags", "type": "object", "$ref": "../../../raml-util/schemas/tags.schema" }, "titleOrPackage": { "description": "title of the material", "type": "string" }, "vendorDetail": { "description": "details related to the vendor of this purchase order line", "type": "object", "$ref": "../../mod-orders-storage/schemas/vendor_detail.json" }, "metadata": { "type": "object", "$ref": "../../../raml-util/schemas/metadata.schema", "readonly": true } }, "additionalProperties": false, "required": [ "acquisitionMethod", "cost", "orderFormat", "source", "titleOrPackage" ] }
- modify_validate(validate: dict)
Validate is cost amount equals to sum of all fund distributions
PUT /orders/order-lines/fund-distributions/validate- Parameters
validate (dict) – See Schema below
- Raises
OkapiRequestUnprocessableEntity – Unprocessable Entity
Schema
{ "$schema": "http://json-schema.org/draft-04/schema#", "description": "Fund distribution amount validation request", "type": "object", "properties": { "cost": { "description": "cost details associated with this purchase order line", "type": "object", "$ref": "../../mod-orders-storage/schemas/cost.json" }, "fundDistribution": { "description": "fund distribution records for this purchase order line", "id": "fundDistribution", "type": "array", "items": { "description": "a fund distribution record", "type": "object", "$ref": "../../mod-orders-storage/schemas/fund_distribution.json" } } }, "additionalProperties": false, "required": [ "cost", "fundDistribution" ] }
- set_orderLine(orderLine: dict)
Post a PO lines to corresponding PO
POST /orders/order-lines- Parameters
orderLine (dict) – See Schema below
- Raises
OkapiRequestError – Bad Request
OkapiRequestUnauthorized – Authentication is required
OkapiFatalError – Server Error
Headers
Location - URI to the created orderLine item
Schema
{ "$schema": "http://json-schema.org/draft-04/schema#", "description": "composite purchase order line with dereferenced/expanded orders fields", "type": "object", "properties": { "id": { "description": "UUID identifying this purchase order line", "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}$" }, "edition": { "description": "edition of the material", "type": "string" }, "checkinItems": { "description": "if true this will toggle the Check-in workflow for details associated with this PO line", "type": "boolean", "default": false }, "instanceId": { "description": "UUID of the instance record this purchase order line is related 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}$" }, "agreementId": { "description": "UUID of the agreement this purchase order line is related 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}$" }, "acquisitionMethod": { "description": "UUID of the acquisition method for this purchase order line", "type": "string", "$ref": "../../common/schemas/uuid.json" }, "automaticExport": { "description": "if true then line will be marked as available to export in the EDIFACT format or other format", "type": "boolean", "default": false }, "alerts": { "description": "alerts associated with this purchase order line", "id": "alerts", "type": "array", "items": { "description": "an alert record", "type": "object", "$ref": "../../mod-orders-storage/schemas/alert.json" } }, "cancellationRestriction": { "description": "whether or not there are cancellation restrictions for this purchase order line", "type": "boolean" }, "cancellationRestrictionNote": { "description": "free-form notes related to cancellation restrictions", "type": "string" }, "claims": { "description": "claims associated with this purchase order line", "id": "claims", "type": "array", "items": { "description": "a claim record", "type": "object", "$ref": "../../mod-orders-storage/schemas/claim.json" } }, "collection": { "description": "whether or not this purchase order line is for a collection", "type": "boolean" }, "contributors": { "description": "list of contributors to the material", "id": "contributors", "type": "array", "items": { "type": "object", "$ref": "../../mod-orders-storage/schemas/contributor.json" } }, "cost": { "description": "cost details associated with this purchase order line", "type": "object", "$ref": "../../mod-orders-storage/schemas/cost.json" }, "description": { "description": "description of the material", "type": "string" }, "details": { "description": "details about this purchase order line", "type": "object", "$ref": "../../mod-orders-storage/schemas/details.json" }, "donor": { "description": "the donor contributing to this purchase order line", "type": "string" }, "eresource": { "description": "eresource-related details of this purchase order line", "type": "object", "$ref": "../../mod-orders-storage/schemas/eresource.json" }, "fundDistribution": { "description": "the UUIDs of the fund distribution records for this purchase order line", "id": "fundDistribution", "type": "array", "items": { "description": "a fund distribution record", "type": "object", "$ref": "../../mod-orders-storage/schemas/fund_distribution.json" } }, "isPackage": { "description": "Indicates that this POL is for a package", "type": "boolean", "default": false }, "locations": { "description": "a list of the location records for this purchase order line", "id": "locations", "type": "array", "items": { "description": "The location details", "type": "object", "$ref": "../../mod-orders-storage/schemas/location.json" } }, "lastEDIExportDate": { "description": "The last date when line was exported in the EDIFACT file", "type": "string", "format": "date-time" }, "orderFormat": { "description": "The purchase order line format", "type": "object", "$ref": "../../mod-orders-storage/schemas/order_format.json" }, "packagePoLineId": { "description": "UUID referencing the poLine that represents the package that this POLs title belongs to", "$ref": "../../common/schemas/uuid.json" }, "paymentStatus": { "description": "The purchase order line payment status", "type": "string", "$ref": "../../mod-orders-storage/schemas/payment_status.json" }, "physical": { "description": "details of this purchase order line relating to physical materials", "type": "object", "$ref": "../../mod-orders-storage/schemas/physical.json" }, "poLineDescription": { "description": "purchase order line description", "type": "string" }, "poLineNumber": { "description": "A human readable number assigned to this PO line", "type": "string", "pattern": "^[a-zA-Z0-9]{1,22}-[0-9]{1,3}$", "readonly": true }, "publicationDate": { "description": "date (year) of the material's publication", "type": "string" }, "publisher": { "description": "publisher of the material", "type": "string" }, "purchaseOrderId": { "description": "UUID of this parent purchase order", "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}$" }, "receiptDate": { "description": "date the purchase order line was received", "type": [ "null", "string" ], "format": "date-time" }, "receiptStatus": { "description": "The purchase order line receipt status", "type": "object", "$ref": "../../mod-orders-storage/schemas/receipt_status.json" }, "renewalNote": { "description": "Renewal note for this purchase order line", "type": "string" }, "reportingCodes": { "description": "a list of reporting codes associated with this purchase order line", "id": "reportingCodes", "type": "array", "items": { "type": "object", "$ref": "../../mod-orders-storage/schemas/reporting_code.json" } }, "requester": { "description": "who requested this purchase order line", "type": "string" }, "rush": { "description": "whether or not this is a rush order", "type": "boolean" }, "selector": { "description": "who selected this material", "type": "string" }, "source": { "description": "the source of this purchase order line", "type": "object", "$ref": "../../mod-orders-storage/schemas/source.json" }, "tags": { "description": "arbitrary tags associated with this purchase order line", "id": "tags", "type": "object", "$ref": "../../../raml-util/schemas/tags.schema" }, "titleOrPackage": { "description": "title of the material", "type": "string" }, "vendorDetail": { "description": "details related to the vendor of this purchase order line", "type": "object", "$ref": "../../mod-orders-storage/schemas/vendor_detail.json" }, "metadata": { "type": "object", "$ref": "../../../raml-util/schemas/metadata.schema", "readonly": true } }, "additionalProperties": false, "required": [ "acquisitionMethod", "cost", "orderFormat", "source", "titleOrPackage" ] }