Procurement
Usage
List purchase orders and purchase requests:
import asyncio
import factorialhr
async def main():
auth = factorialhr.AccessTokenAuth("your_access_token")
async with factorialhr.ApiClient(auth=auth) as api:
orders = factorialhr.PurchaseOrdersEndpoint(api)
response = await orders.get(params={"limit": 20})
for po in response.data():
print(po.id, po.status, po.total_amount)
requests = factorialhr.PurchaseRequestsEndpoint(api)
for pr in (await requests.all()).data():
print(pr.id, pr.status)
asyncio.run(main())
Enums
Models and endpoints
- class factorialhr.ProcurementType(*, id: int, company_id: int, name: str, created_at: datetime, updated_at: datetime, author_id: int | None = None, description: str | None = None, enabled: bool | None = None, identifier: str | None = None)[source]
Model for procurement_type.
- author_id: int | None
Employee ID who created this type (null for system types)
- company_id: int
Identifier of the company that owns this type
- created_at: datetime
Time the procurement type was created
- description: str | None
Description of the procurement type
- enabled: bool | None
Defines if a type is enabled
- id: int
The id of the type
- identifier: str | None
System identifier for default types
- name: str
Name of the procurement type
- updated_at: datetime
Time the procurement type was last updated
- class factorialhr.ProcurementTypesEndpoint(api: ApiClient)[source]
Endpoint for procurement/types operations.
- async all(**kwargs) ListApiResponse[ProcurementType][source]
Get all procurement types records.
Official documentation: procurement/types
- Parameters:
kwargs (optional) – Optional keyword arguments (e.g.
paramsfor query string) forwarded to the HTTP request.- Raises:
httpx.HTTPStatusError – When the API returns an error status code.
- Returns:
Response containing the list of records.
- Return type:
- async get(**kwargs) MetaApiResponse[ProcurementType][source]
Get procurement types with pagination metadata.
Official documentation: procurement/types
- Parameters:
kwargs (optional) – Optional keyword arguments (e.g.
paramsfor query string) forwarded to the HTTP request.- Raises:
httpx.HTTPStatusError – When the API returns an error status code.
- Returns:
Response containing records and pagination metadata.
- Return type:
- async get_by_id(type_id: int | str, **kwargs) ProcurementType[source]
Get a specific procurement type by ID.
Official documentation: procurement/types
- Parameters:
type_id (int | str) – The unique identifier.
kwargs (optional) – Optional keyword arguments (e.g.
paramsfor query string) forwarded to the HTTP request.
- Raises:
httpx.HTTPStatusError – When the API returns an error status code.
- Returns:
The record.
- Return type:
- class factorialhr.PurchaseOrder(*, id: int, po_number: int, description: str, status: PurchaseOrderStatus, cost: Mapping[str, Any], date: str, purchase_request_id: int, legal_entity_id: int, company_id: int, formatted_po_number: str, vendor_id: int | None = None)[source]
Model for procurement_purchase_order.
- company_id: int
Identifier of the company that owns this purchase order
- cost: Mapping[str, Any]
Total cost of the purchase order
- date: str
Date when the purchase order was created
- description: str
Description or notes about the purchase order
- formatted_po_number: str
Formatted purchase order number with prefix (e.g., PO-00001)
- id: int
Unique identifier of the purchase order
- legal_entity_id: int
Identifier of the legal entity that owns this purchase order
- po_number: int
Purchase order number assigned to this order
- purchase_request_id: int
Identifier of the purchase request that generated this purchase order
- status: PurchaseOrderStatus
Current status of the purchase order
- vendor_id: int | None
Identifier of the vendor (contact) associated with this purchase order
- class factorialhr.PurchaseOrdersEndpoint(api: ApiClient)[source]
Endpoint for procurement/purchase_orders operations.
- async all(**kwargs) ListApiResponse[PurchaseOrder][source]
Get all purchase orders records.
Official documentation: procurement/purchase_orders
- Parameters:
kwargs (optional) – Optional keyword arguments (e.g.
paramsfor query string) forwarded to the HTTP request.- Raises:
httpx.HTTPStatusError – When the API returns an error status code.
- Returns:
Response containing the list of records.
- Return type:
- async get(**kwargs) MetaApiResponse[PurchaseOrder][source]
Get purchase orders with pagination metadata.
Official documentation: procurement/purchase_orders
- Parameters:
kwargs (optional) – Optional keyword arguments (e.g.
paramsfor query string) forwarded to the HTTP request.- Raises:
httpx.HTTPStatusError – When the API returns an error status code.
- Returns:
Response containing records and pagination metadata.
- Return type:
- async get_by_id(purchase_order_id: int | str, **kwargs) PurchaseOrder[source]
Get a specific purchase order by ID.
Official documentation: procurement/purchase_orders
- Parameters:
purchase_order_id (int | str) – The unique identifier.
kwargs (optional) – Optional keyword arguments (e.g.
paramsfor query string) forwarded to the HTTP request.
- Raises:
httpx.HTTPStatusError – When the API returns an error status code.
- Returns:
The record.
- Return type:
- class factorialhr.PurchaseRequest(*, id: int, description: str, type_id: int, cost: Mapping[str, Any], date: str, requester_employee_id: int, status: PurchaseRequestStatus, company_id: int | None = None, vendor_id: int | None = None, url: str | None = None, additional_information: str | None = None, deadline: date | None = None)[source]
Model for procurement_purchase_request.
- additional_information: str | None
Additional information or notes about the purchase request
- company_id: int | None
Identifier of the company that owns this purchase request
- cost: Mapping[str, Any]
Total cost of the purchase request
- date: str
Date when the purchase request was created
- deadline: date | None
Deadline date for the purchase request
- description: str
Description or notes about the purchase request
- id: int
Unique identifier of the purchase request
- requester_employee_id: int
Identifier of the employee who requested this purchase
- status: PurchaseRequestStatus
Current status of the purchase request
- type_id: int
The id of the referred type
- url: str | None
URL related to the purchase request (e.g., product link)
- vendor_id: int | None
Identifier of the vendor (contact) associated with this purchase request
- class factorialhr.PurchaseRequestsEndpoint(api: ApiClient)[source]
Endpoint for procurement/purchase_requests operations.
- async all(**kwargs) ListApiResponse[PurchaseRequest][source]
Get all purchase requests records.
Official documentation: procurement/purchase_requests
- Parameters:
kwargs (optional) – Optional keyword arguments (e.g.
paramsfor query string) forwarded to the HTTP request.- Raises:
httpx.HTTPStatusError – When the API returns an error status code.
- Returns:
Response containing the list of records.
- Return type:
- async get(**kwargs) MetaApiResponse[PurchaseRequest][source]
Get purchase requests with pagination metadata.
Official documentation: procurement/purchase_requests
- Parameters:
kwargs (optional) – Optional keyword arguments (e.g.
paramsfor query string) forwarded to the HTTP request.- Raises:
httpx.HTTPStatusError – When the API returns an error status code.
- Returns:
Response containing records and pagination metadata.
- Return type:
- async get_by_id(purchase_request_id: int | str, **kwargs) PurchaseRequest[source]
Get a specific purchase request by ID.
Official documentation: procurement/purchase_requests
- Parameters:
purchase_request_id (int | str) – The unique identifier.
kwargs (optional) – Optional keyword arguments (e.g.
paramsfor query string) forwarded to the HTTP request.
- Raises:
httpx.HTTPStatusError – When the API returns an error status code.
- Returns:
The record.
- Return type: