Inventory Service
The `InventoryService` is your primary tool for interacting with inventory-related records and actions. It provides methods for managing inventory transactions, querying inventory levels, and updating warehouse-specific item details.
Importing Helpers
To use the service, you will need to import the necessary builders from `easy_acumatica.models`.
from easy_acumatica.models.inventory_issue_builder import InventoryIssueBuilder
from easy_acumatica.models.item_warehouse_builder import ItemWarehouseBuilder
from easy_acumatica.models.inquiry_builder import InquiryBuilder
Service Methods
create_inventory_issue(api_version, builder)
Creates a new inventory issue record. You must provide an `InventoryIssueBuilder` instance containing the transaction details.
# 1. Build the inventory issue payload
issue_payload = (
InventoryIssueBuilder()
.set("Description", "Issue for project materials")
.add_detail(
InventoryID="RAW-MAT-01",
Warehouse="MAIN",
Qty=10,
UOM="EACH"
)
)
# 2. Use the payload to create the record
new_issue = client.inventory.create_inventory_issue("24.200.001", issue_payload)
release_inventory_issue(api_version, reference_nbr, ...)
Invokes the `ReleaseInventoryIssue` action on an existing inventory issue. This is a long-running action, so the method handles the polling necessary to wait for completion.
# The reference number from the created issue
issue_ref_nbr = "004683"
# This will block until the release is complete or it times out
client.inventory.release_inventory_issue(
"24.200.001",
reference_nbr=issue_ref_nbr
)
get_inventory_quantity_available(...)
Retrieves quantity information for a specific item using the `InventoryQuantityAvailable` inquiry form. This method uses the `InquiriesService` internally.
# Fetch quantity data for a specific item
quantity_data = client.inventory.get_inventory_quantity_available(
"24.200.001",
inventory_id="MYITEM",
last_modified_date_time="2023-01-01T00:00:00"
)
for row in quantity_data:
print(f"Warehouse: {row['Warehouse']['value']}, Qty Available: {row['QtyAvailable']['value']}")
get_inventory_summary(api_version, inventory_id)
Retrieves summary information for a specific item across all warehouses using the `InventorySummaryInquiry` form.
# Fetch summary data for a specific item
summary_data = client.inventory.get_inventory_summary("24.200.001", "MYITEM")
for row in summary_data:
print(f"Warehouse: {row['Warehouse']['value']}, Qty On Hand: {row['QtyOnHand']['value']}")
update_item_warehouse_details(api_version, builder)
This method allows you to update settings for an item at a specific warehouse, such as replenishment settings or default GL accounts.
# 1. Build the update payload
item_warehouse_payload = (
ItemWarehouseBuilder()
.inventory_id("MYITEM")
.warehouse_id("MAIN")
.set("DefaultIssueFrom", "RECEIVING") # Set the new default location
)
# 2. Use the payload to update the record
updated_details = client.inventory.update_item_warehouse_details(
"24.200.001",
builder=item_warehouse_payload
)