ItemWarehouseBuilder
The `ItemWarehouseBuilder` is your primary tool for creating the JSON payload needed to update `ItemWarehouse` records with the `InventoryService`. It allows you to modify an item's settings for a specific warehouse.
Importing the Builder
To get started, import the `ItemWarehouseBuilder` from the `easy_acumatica.models` module.
from easy_acumatica.models.item_warehouse_builder import ItemWarehouseBuilder
Builder Methods
To update an item's warehouse details, you must specify both the `InventoryID` and the `WarehouseID` using their respective shortcut methods.
item_warehouse_payload = (
ItemWarehouseBuilder()
.inventory_id("ITEM001")
.warehouse_id("MAIN")
)
.override(field, value)
A common use case is to override default replenishment or other settings. The `.override()` method simplifies this by automatically prefixing the field name with "Override" (e.g., `.override("Replenishment", True)` sets the `OverrideReplenishment` field).
# Build a payload to update replenishment settings
item_warehouse_payload = (
ItemWarehouseBuilder()
.inventory_id("ITEM001")
.warehouse_id("MAIN")
.override("Replenishment", True)
.set("ReplenishmentSource", "Purchase")
.set("PreferredVendor", "VENDOR01")
)
.to_body()
Once you have set all the required fields, call `.to_body()` to generate the final dictionary, which is ready to be sent as the JSON body in your API request.
# Build the full payload
details_to_update = (
ItemWarehouseBuilder()
.inventory_id("ITEM001")
.warehouse_id("MAIN")
.set("IsAValuationMethod", "Standard")
.set("StdCost", 15.50)
)
# Get the final dictionary
json_body = details_to_update.to_body()
# Use with the InventoryService
# client.inventory.update_item_warehouse_details("24.200.001", builder=details_to_update)