Pricings
albert.collections.pricings.PricingCollection
Bases: BaseCollection
Manage Pricing entries for Inventory Items in the Albert platform.
A Pricing is a price entry for an Inventory Item
(InventoryItem): a cost for a given
amount of the material, recorded for a specific company and location. An item
can have many pricings (for example, different suppliers, sites, or pack
sizes), so pricings are usually retrieved by the inventory item they belong to
rather than one at a time.
This collection is accessed as client.pricings.
Example
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session
|
AlbertSession
|
The authenticated Albert session used for API calls. |
required |
Attributes:
| Name | Type | Description |
|---|---|---|
base_path |
str
|
The base API route for pricing requests. |
Methods:
| Name | Description |
|---|---|
create |
Create a new pricing entry for an inventory item. |
get_by_id |
Get a single pricing by its ID. |
get_by_inventory_id |
Get the pricings for one inventory item, optionally grouped/filtered. |
get_by_inventory_ids |
Get pricings for several inventory items at once. |
update |
Update an existing pricing. |
delete |
Delete a pricing by its ID. |
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session
|
AlbertSession
|
The authenticated Albert session used for API calls. |
required |
Source code in src/albert/collections/pricings.py
create
Create a new pricing entry for an inventory item.
Example
from albert.resources.pricings import Pricing
from albert.resources.companies import Company
from albert.resources.locations import Location
pricing = Pricing(
inventory_id="INVA9999999",
company=Company(name="Acme Chemicals"),
location=Location(name="Pittsburgh"),
price=12.50,
)
created = client.pricings.create(pricing=pricing)
created.id
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pricing
|
Pricing
|
required |
Returns:
| Type | Description |
|---|---|
Pricing
|
The newly created pricing, populated with its assigned ID. |
Source code in src/albert/collections/pricings.py
get_by_id
Get a single pricing by its ID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
str
|
The ID of the pricing to retrieve. |
required |
Returns:
| Type | Description |
|---|---|
Pricing
|
The fully populated pricing. |
Source code in src/albert/collections/pricings.py
get_by_inventory_id
get_by_inventory_id(
*,
inventory_id: InventoryId,
group_by: PricingBy | None = None,
filter_by: PricingBy | None = None,
filter_id: str | None = None,
order_by: OrderBy | None = None,
) -> list[Pricing]
Get the pricings for a single inventory item.
Returns every pricing entry attached to the given inventory item, with
optional grouping, filtering, and sorting. To pull pricings for many items
at once, use get_by_inventory_ids.
Example
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
inventory_id
|
str
|
The Inventory ID to retrieve pricings for (format |
required |
group_by
|
PricingBy
|
Group the results by company or location. See
|
None
|
filter_by
|
PricingBy
|
The dimension (company or location) to filter on. Pair with
|
None
|
filter_id
|
str
|
The ID to match on the |
None
|
order_by
|
OrderBy
|
Sort direction for the results. |
None
|
Returns:
| Type | Description |
|---|---|
list[Pricing]
|
The pricings for the item matching the provided parameters. |
Source code in src/albert/collections/pricings.py
get_by_inventory_ids
get_by_inventory_ids(
*, inventory_ids: list[InventoryId]
) -> list[InventoryPricings]
Get pricings for several inventory items at once.
Each returned InventoryPricings groups
one item's pricings under its inventory ID.
Example
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
inventory_ids
|
list[str]
|
The Inventory IDs to retrieve pricings for (format |
required |
Returns:
| Type | Description |
|---|---|
list[InventoryPricings]
|
One entry per item, each holding that item's pricings. |
Source code in src/albert/collections/pricings.py
delete
delete(*, id: str) -> None
Delete a pricing by its ID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
str
|
The ID of the pricing to delete. |
required |
Returns:
| Type | Description |
|---|---|
None
|
|
Source code in src/albert/collections/pricings.py
update
Update an existing pricing.
Fetch the pricing (e.g. with get_by_id), modify the updatable
fields on the returned object, then pass it here. The company and
location links can also be reassigned.
Example
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pricing
|
Pricing
|
The pricing to update. Must have a valid |
required |
Returns:
| Type | Description |
|---|---|
Pricing
|
The updated pricing as it appears in Albert. |
Notes
The following fields can be updated: currency, default,
description, expiration_date, fob, inventory_id,
lead_time, lead_time_unit, pack_size, price.
default must be 0 (not default) or 1 (default). Can only be
set via update, not on create.