Inventory
albert.collections.inventory.InventoryCollection
Bases: BaseCollection
Manage Inventory Items in the Albert platform.
An Inventory Item is a catalog entry for a physical or formulated material tracked in Albert. Every item belongs to one of four categories:
RawMaterials: purchased substances used as ingredients (e.g. a solvent or pigment), typically linked to a manufacturing Company and one or more CAS numbers.Consumables: supplies consumed during lab work (e.g. gloves, vials).Equipment: instruments and apparatus.Formulas: mixtures designed in Albert. Formulas are created through the Worksheet collection (WorksheetCollection), not here;createrejects Formula items.
Inventory Items are referenced throughout the platform by their Inventory ID
(format INV..., e.g. "INVA9999999"). They are the building blocks that
Worksheets, Tasks, and Property Data all point back to.
This collection is accessed as client.inventory.
Example
from albert import Albert
from albert.resources.inventory import InventoryCategory
client = Albert()
# Find raw materials mentioning "titanium dioxide"
items = client.inventory.get_all(
text="titanium dioxide",
category=InventoryCategory.RAW_MATERIALS,
max_items=25,
)
for item in items:
print(item.id, item.name)
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 inventory requests. |
Methods:
| Name | Description |
|---|---|
create |
Create a new inventory item (raw material, consumable, or equipment). |
get_by_id |
Get a single fully populated item by its ID. |
get_by_ids |
Get many items by their IDs in batches. |
search |
Fast, lightweight search returning partial items (best for lookups/counts). |
get_all |
Same filters as search, but returns fully populated items (slower). |
update |
Update an existing item. |
delete |
Delete an item by its ID. |
merge |
Merge duplicate item(s) into a single parent item. |
exists |
Check whether an item with the same name and company already exists. |
get_match_or_none |
Return the existing item matching name + company, or None. |
add_specs |
Attach inventory reference specs to an item (deprecated; prefer client.attributes). |
get_specs |
Get inventory reference specs for items (deprecated; prefer client.attributes). |
get_all_facets |
Get facet groups (aggregated filter counts) for a query. |
get_facet_by_name |
Get a single named facet group for a query. |
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session
|
AlbertSession
|
The authenticated Albert session used for API calls. |
required |
Source code in src/albert/collections/inventory.py
merge
merge(
*,
parent_id: InventoryId,
child_id: InventoryId | list[InventoryId],
modules: list[InventoryMergeModule] | None = None,
) -> None
Merge one or more duplicate inventory items into a single parent item.
Use this to consolidate duplicates: the child item(s) are folded into the
parent, and their data (as selected by modules) is carried over. The
child items are removed as standalone entries.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parent_id
|
InventoryId
|
The item to keep. All merged data ends up here. |
required |
child_id
|
InventoryId or list[InventoryId]
|
The duplicate item(s) to merge into the parent. At least one is required. |
required |
modules
|
list[InventoryMergeModule]
|
Which categories of data to carry over from the children (e.g. pricing, notes). Defaults to all modules. |
None
|
Returns:
| Type | Description |
|---|---|
None
|
|
Source code in src/albert/collections/inventory.py
exists
exists(*, inventory_item: InventoryItem) -> bool
Check whether a matching inventory item already exists.
A match is determined by name and company, the same way create
detects duplicates. Useful before creating an item to avoid duplicates.
Example
from albert.resources.inventory import InventoryItem, InventoryCategory
from albert.resources.companies import Company
candidate = InventoryItem(
name="Acetone",
category=InventoryCategory.RAW_MATERIALS,
company=Company(name="Acme Chemicals"),
)
client.inventory.exists(inventory_item=candidate)
# True
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
inventory_item
|
InventoryItem
|
The item to look for. Its |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if a matching item exists, False otherwise. |
Source code in src/albert/collections/inventory.py
get_match_or_none
get_match_or_none(
*, inventory_item: InventoryItem
) -> InventoryItem | None
Return the existing item matching name and company, or None.
Like exists, but returns the matched item itself so you can reuse
its ID instead of creating a duplicate.
Example
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
inventory_item
|
InventoryItem
|
The item to match. Its |
required |
Returns:
| Type | Description |
|---|---|
InventoryItem or None
|
The matching item, or None if no match is found. |
Source code in src/albert/collections/inventory.py
create
create(
*,
inventory_item: InventoryItem,
avoid_duplicates: bool = True,
) -> InventoryItem
Create a new inventory item.
Use this to add a raw material, consumable, or equipment item to the catalog. Formula items are not supported here; build those through the Worksheet collection.
Any tags or company on the item that do not yet exist in Albert are
created automatically before the item is registered (see
CompanyCollection and
TagCollection).
Example
from albert.resources.inventory import InventoryItem, InventoryCategory
from albert.resources.companies import Company
item = InventoryItem(
name="Titanium Dioxide",
category=InventoryCategory.RAW_MATERIALS,
company=Company(name="Acme Chemicals"),
)
created = client.inventory.create(inventory_item=item)
created.id
# 'INVA9999999'
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
inventory_item
|
InventoryItem
|
The item to create. |
required |
avoid_duplicates
|
bool
|
When True (default), if an item with the same name and company already exists, that existing item is returned instead of creating a duplicate. Set to False to force creation. |
True
|
Returns:
| Type | Description |
|---|---|
InventoryItem
|
The newly created item, populated with its assigned Inventory ID. |
Raises:
| Type | Description |
|---|---|
NotImplementedError
|
If |
Source code in src/albert/collections/inventory.py
273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 | |
get_by_id
get_by_id(*, id: InventoryId) -> InventoryItem
Get a single, fully populated inventory item by its ID.
For retrieving many items at once, use get_by_ids. To find items
without knowing their IDs, use search or get_all.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
InventoryId
|
The Inventory ID (format |
required |
Returns:
| Type | Description |
|---|---|
InventoryItem
|
The fully populated item. |
Source code in src/albert/collections/inventory.py
get_by_ids
get_by_ids(
*, ids: list[InventoryId]
) -> list[InventoryItem]
Get multiple fully populated inventory items by their IDs.
Requests are automatically split into batches, so arbitrarily long ID lists are supported. Items not found are omitted from the result.
Example
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ids
|
list[InventoryId]
|
The Inventory IDs to retrieve (format |
required |
Returns:
| Type | Description |
|---|---|
list[InventoryItem]
|
The matching items. Order is not guaranteed to match the input. |
Source code in src/albert/collections/inventory.py
get_specs
get_specs(
*, ids: list[InventoryId]
) -> list[InventorySpecList]
Get the legacy inventory reference specs attached to inventory items.
Each InventorySpecList
holds that item's declared reference properties (definition and value
together). This is not Property Data: for measured task results or
custom property-data values, use
PropertyDataCollection.
Requests are automatically batched.
Deprecated
Prefer
get_by_parent_ids
(client.attributes). Specs are removed in SDK 2.0. See the Specs →
Attributes migration guide.
Example
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ids
|
list[InventoryId]
|
The Inventory IDs to fetch specs for (format |
required |
Returns:
| Type | Description |
|---|---|
list[InventorySpecList]
|
One entry per item, each holding that item's specs. |
Source code in src/albert/collections/inventory.py
add_specs
add_specs(
*,
inventory_id: InventoryId,
specs: InventorySpec | list[InventorySpec],
) -> InventorySpecList
Attach legacy inventory reference specs to an inventory item.
Each InventorySpec both
defines a property (name, data_column_id) and assigns its expected
InventorySpecValue on
this item. Use Specs for inventory reference properties (e.g. a
supplier-stated density that worksheets look up). For experimentally
measured results, use Tasks and
PropertyDataCollection
instead. A spec may optionally name conditions via a workflow.
Deprecated
Prefer
add_values
(client.attributes) after creating shared attribute definitions.
Specs are removed in SDK 2.0. See the Specs → Attributes migration guide.
Warning
This call replaces the item's complete spec set; it is not an
append. Always pass every spec the item should carry in one call: a
follow-up call with a subset can drop previously attached specs. A
500 Duplicate reference name error means spec rows with those
names already exist on the item (even when get_specs shows
none); do not blindly retry, call get_specs first and
reconcile. There is no Specs API to remove individual values.
Example
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
inventory_id
|
InventoryId
|
The item to attach the specs to (format |
required |
specs
|
InventorySpec or list[InventorySpec]
|
The full set of reference specs the item should carry. Each embeds the property definition and value (and optionally workflow conditions). |
required |
Returns:
| Type | Description |
|---|---|
InventorySpecList
|
The full set of specs now attached to the item. |
Source code in src/albert/collections/inventory.py
delete
delete(*, id: InventoryId) -> None
Delete an inventory item by its ID.
This permanently removes the item. To consolidate duplicates while
preserving data, use merge instead.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
InventoryId
|
The Inventory ID to delete (format |
required |
Returns:
| Type | Description |
|---|---|
None
|
|
Source code in src/albert/collections/inventory.py
get_all_facets
get_all_facets(
*,
text: str | None = None,
cas: list[Cas] | Cas | None = None,
category: list[InventoryCategory]
| InventoryCategory
| None = None,
company: list[Company] | Company | None = None,
location: list[Location] | Location | None = None,
storage_location: list[
StorageLocation | StorageLocationFilter
]
| StorageLocation
| StorageLocationFilter
| None = None,
project_id: ProjectId | None = None,
sheet_id: WorksheetId | None = None,
created_by: list[User]
| User
| str
| list[str]
| None = None,
lot_owner: list[User] | User | None = None,
tags: list[str] | None = None,
match_all_conditions: bool = False,
) -> list[FacetItem]
Get the facets available for an inventory search.
Facets are the grouped, counted filter options for a query, like the
refinement sidebar of a search UI (e.g. how many matching items fall under
each category, company, or tag). Use them to build progressive filtering
or to summarize a result set without fetching every item. To pull a single
named facet, use get_facet_by_name.
Example
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
Free-text query matched against item name and related fields. |
None
|
cas
|
Cas or list[Cas]
|
Filter by CAS number(s). |
None
|
category
|
InventoryCategory or list[InventoryCategory]
|
Filter by category: |
None
|
company
|
Company or list[Company]
|
Filter by manufacturing Company. |
None
|
location
|
Location or list[Location]
|
Filter by location. |
None
|
storage_location
|
StorageLocation or StorageLocationFilter or list[StorageLocation | StorageLocationFilter]
|
Filter by storage location. |
None
|
project_id
|
ProjectId
|
Filter by project. |
None
|
sheet_id
|
WorksheetId
|
Filter by worksheet. |
None
|
created_by
|
User, list[User], str, or list[str]
|
Filter by creator. Accepts user display name(s) or UserId(s) (e.g.
|
None
|
lot_owner
|
User or list[User]
|
Filter by lot owner. |
None
|
tags
|
list[str]
|
Filter by tag name(s). |
None
|
match_all_conditions
|
bool
|
If True, only count items that satisfy every applied filter (AND logic). Default False. |
False
|
Returns:
| Type | Description |
|---|---|
list[FacetItem]
|
The facet groups available for the query. |
Source code in src/albert/collections/inventory.py
781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 | |
get_facet_by_name
get_facet_by_name(
name: str | list[str],
*,
text: str | None = None,
cas: list[Cas] | Cas | None = None,
category: list[InventoryCategory]
| InventoryCategory
| None = None,
company: list[Company] | Company | None = None,
location: list[Location] | Location | None = None,
storage_location: list[
StorageLocation | StorageLocationFilter
]
| StorageLocation
| StorageLocationFilter
| None = None,
project_id: ProjectId | None = None,
sheet_id: WorksheetId | None = None,
created_by: list[User]
| User
| str
| list[str]
| None = None,
lot_owner: list[User] | User | None = None,
tags: list[str] | None = None,
match_all_conditions: bool = False,
) -> list[FacetItem]
Return one or more named facets for an inventory search.
A convenience wrapper over get_all_facets that keeps only the
facet group(s) you name. Useful for iterative search refinement, e.g.
fetching the remaining Tags facet after other filters are applied.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str or list[str]
|
The facet group name(s) to return (e.g. |
required |
text
|
str
|
Search text for full-text matching. |
None
|
cas
|
list[Cas] | Cas | None
|
Filter by CAS values. |
None
|
category
|
list[InventoryCategory] | InventoryCategory | None
|
Filter by inventory category. |
None
|
company
|
list[Company] | Company | None
|
Filter by company. |
None
|
location
|
list[Location] | Location | None
|
Filter by location. |
None
|
storage_location
|
list[StorageLocation | StorageLocationFilter] | StorageLocation | StorageLocationFilter | None
|
Filter by storage location. |
None
|
project_id
|
ProjectId | None
|
Filter by project. |
None
|
sheet_id
|
WorksheetId | None
|
Filter by worksheet. |
None
|
created_by
|
User, list[User], str, or list[str]
|
Filter by creator. Accepts user display name(s) or UserId(s) (e.g.
|
None
|
lot_owner
|
list[User] | User | None
|
Filter by lot owner. |
None
|
tags
|
list[str] | None
|
Filter by tags. |
None
|
match_all_conditions
|
bool
|
If True, only count items that satisfy every applied filter (AND logic). Default False. |
False
|
Returns:
| Type | Description |
|---|---|
list[FacetItem]
|
The facet group(s) matching |
Source code in src/albert/collections/inventory.py
876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 | |
search
search(
*,
text: str | None = None,
cas: list[Cas] | Cas | None = None,
category: list[InventoryCategory]
| InventoryCategory
| None = None,
company: list[Company] | Company | None = None,
location: list[Location] | Location | None = None,
storage_location: list[
StorageLocation | StorageLocationFilter
]
| StorageLocation
| StorageLocationFilter
| None = None,
project_id: ProjectId | None = None,
sheet_id: WorksheetId | None = None,
created_by: list[User]
| User
| str
| list[str]
| None = None,
lot_owner: list[User] | User | None = None,
tags: list[str] | None = None,
match_all_conditions: bool = False,
order: OrderBy = DESCENDING,
sort_by: str | None = None,
max_items: int | None = None,
offset: int | None = 0,
from_created_at: str | None = None,
to_created_at: str | None = None,
updated_by: str | list[str] | None = None,
from_updated_at: str | None = None,
to_updated_at: str | None = None,
albert_id: str | list[str] | None = None,
attribute_id: str | list[str] | None = None,
cas_smile: str | list[str] | None = None,
collaborator_pop_up: bool | None = None,
contains_field: str | list[str] | None = None,
contains_text: str | list[str] | None = None,
created_by_id: str | list[str] | None = None,
details: bool | None = None,
drop_down_text: str | None = None,
drop_down_text_prop: str | None = None,
dup_detection: bool | None = None,
facet_field: str | None = None,
facet_text: str | None = None,
from_expiration_date: str | None = None,
from_lot_created_at: str | None = None,
from_on_hand: str | None = None,
gslo_group: str | list[str] | None = None,
idh: str | list[str] | None = None,
is_pop_up: bool | None = None,
lot_created_by: list[User]
| User
| str
| list[str]
| None = None,
material_category: str | list[str] | None = None,
pack_size: str | list[str] | None = None,
pictogram_name: str | list[str] | None = None,
result: str | list[str] | None = None,
rsn: str | list[str] | None = None,
source_field: str | list[str] | None = None,
status: str | list[str] | None = None,
sub_category: str | list[str] | None = None,
synthesis_product_created: str
| list[str]
| None = None,
to_expiration_date: str | None = None,
to_lot_created_at: str | None = None,
to_on_hand: str | None = None,
metadata_filters: dict[str, Any] | None = None,
custom_fields: dict[str, Any] | None = None,
additional_field: str | list[str] | None = None,
project_facets: dict[str, Any] | None = None,
composite_search: dict[str, Any] | None = None,
) -> Iterator[InventorySearchItem]
Search for inventory items matching the given filters.
Returns lightweight, partially populated results and is the fastest way to
look items up (best for name lookups, counts, or feeding IDs into another
call). Fields such as full CAS breakdowns and metadata are omitted; when
you need complete items, use get_all with the same filters, or pass
the resulting IDs to get_by_ids.
Filters are combined with OR logic by default (an item matches if it
satisfies any filter); set match_all_conditions=True to require every
filter to match. Results are returned as a lazily paginated iterator, so
iterating fetches additional pages on demand.
Example
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
Free-text query matched against item name, alias, and related fields. Only the first 50 characters are used. |
None
|
cas
|
Cas or list[Cas]
|
Filter by CAS number(s). |
None
|
category
|
InventoryCategory or list[InventoryCategory]
|
Filter by category: |
None
|
company
|
Company or list[Company]
|
Filter by manufacturing Company. |
None
|
location
|
Location or list[Location]
|
Filter by location. |
None
|
storage_location
|
StorageLocation or StorageLocationFilter or list[StorageLocation | StorageLocationFilter]
|
Filter by storage location. |
None
|
project_id
|
str
|
Filter by the project a formula belongs to (Formula items only). |
None
|
sheet_id
|
str
|
Filter by worksheet ID. |
None
|
created_by
|
User, list[User], str, or list[str]
|
Filter by creator. Accepts user display name(s) or UserId(s) (e.g.
|
None
|
lot_owner
|
User or list[User]
|
Filter by lot owner(s). |
None
|
tags
|
list[str]
|
Filter by tag name(s). |
None
|
match_all_conditions
|
bool
|
Require every filter to match (AND logic). Default False (OR logic). |
False
|
order
|
OrderBy
|
Sort direction. Default |
DESCENDING
|
sort_by
|
str
|
Field to sort by. Default None (server default order). |
None
|
max_items
|
int
|
Maximum number of items to return in total. If None, iterates over all matches. |
None
|
from_created_at
|
str
|
Only include items created on or after this date, formatted as
|
None
|
to_created_at
|
str
|
Only include items created on or before this date, formatted as
|
None
|
updated_by
|
str or list[str]
|
Filter by user(s) who last updated the item. Accepts UserId(s) only
(e.g. |
None
|
from_updated_at
|
str
|
Only include items updated on or after this date (ISO 8601). |
None
|
to_updated_at
|
str
|
Only include items updated on or before this date (ISO 8601). |
None
|
metadata_filters
|
dict[str, Any]
|
Filter by custom field (metadata) values. |
None
|
albert_id
|
str or list[str]
|
Filter by Albert ID(s). |
None
|
attribute_id
|
str or list[str]
|
Filter by attribute ID(s). Cannot be combined with |
None
|
cas_smile
|
str or list[str]
|
Filter by CAS SMILES string(s). |
None
|
collaborator_pop_up
|
bool
|
Apply collaborator popup search behavior. |
None
|
contains_field
|
str or list[str]
|
Field(s) for contains-style filtering. |
None
|
contains_text
|
str or list[str]
|
Text value(s) paired with |
None
|
created_by_id
|
str or list[str]
|
Filter by creator UserId(s). |
None
|
details
|
bool
|
Invoke custom logic for the worksheet details view. |
None
|
drop_down_text
|
str
|
Dropdown search text. |
None
|
drop_down_text_prop
|
str
|
Dropdown search property name. |
None
|
dup_detection
|
bool
|
Enable duplicate-detection text sanitization. |
None
|
facet_field
|
str
|
Facet field to filter on. |
None
|
facet_text
|
str
|
Facet text to match. |
None
|
from_expiration_date
|
str
|
Only include lots expiring on or after this date ( |
None
|
from_lot_created_at
|
str
|
Only include lots created on or after this date ( |
None
|
from_on_hand
|
str
|
Minimum on-hand quantity filter. |
None
|
gslo_group
|
str or list[str]
|
Filter by GSLO group(s). |
None
|
idh
|
str or list[str]
|
Filter by IDH value(s). |
None
|
is_pop_up
|
bool
|
Apply popup search behavior. |
None
|
lot_created_by
|
User, list[User], str, or list[str]
|
Filter by lot creator. Accepts display name(s), UserId(s), or
|
None
|
material_category
|
str or list[str]
|
Filter by material category. |
None
|
pack_size
|
str or list[str]
|
Filter by pack size. |
None
|
pictogram_name
|
str or list[str]
|
Filter by pictogram name(s). |
None
|
result
|
str or list[str]
|
Filter by result value(s). |
None
|
rsn
|
str or list[str]
|
Filter by RSN value(s). |
None
|
source_field
|
str or list[str]
|
Restrict which fields are returned in search results. |
None
|
status
|
str or list[str]
|
Filter by status value(s). |
None
|
sub_category
|
str or list[str]
|
Filter by sub-category. |
None
|
synthesis_product_created
|
str or list[str]
|
Filter by synthesis product creation value(s). |
None
|
to_expiration_date
|
str
|
Only include lots expiring on or before this date ( |
None
|
to_lot_created_at
|
str
|
Only include lots created on or before this date ( |
None
|
to_on_hand
|
str
|
Maximum on-hand quantity filter. |
None
|
custom_fields
|
dict[str, Any]
|
Filter by custom field values. |
None
|
additional_field
|
str or list[str]
|
Request additional columns from the search index. |
None
|
project_facets
|
dict[str, Any]
|
Project facet filters. |
None
|
composite_search
|
dict[str, Any]
|
Composite search specification. |
None
|
Returns:
| Type | Description |
|---|---|
Iterator[InventorySearchItem]
|
A lazily paginated iterator of partially populated search results. |
Source code in src/albert/collections/inventory.py
971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 | |
get_all
get_all(
*,
text: str | None = None,
cas: list[Cas] | Cas | None = None,
category: list[InventoryCategory]
| InventoryCategory
| None = None,
company: list[Company] | Company | None = None,
location: list[Location] | Location | None = None,
storage_location: list[
StorageLocation | StorageLocationFilter
]
| StorageLocation
| StorageLocationFilter
| None = None,
project_id: ProjectId | None = None,
sheet_id: WorksheetId | None = None,
created_by: list[User]
| User
| str
| list[str]
| None = None,
lot_owner: list[User] | User | None = None,
tags: list[str] | None = None,
match_all_conditions: bool = False,
order: OrderBy = DESCENDING,
sort_by: str | None = None,
max_items: int | None = None,
offset: int | None = 0,
from_created_at: str | None = None,
to_created_at: str | None = None,
updated_by: str | list[str] | None = None,
from_updated_at: str | None = None,
to_updated_at: str | None = None,
albert_id: str | list[str] | None = None,
attribute_id: str | list[str] | None = None,
cas_smile: str | list[str] | None = None,
collaborator_pop_up: bool | None = None,
contains_field: str | list[str] | None = None,
contains_text: str | list[str] | None = None,
created_by_id: str | list[str] | None = None,
details: bool | None = None,
drop_down_text: str | None = None,
drop_down_text_prop: str | None = None,
dup_detection: bool | None = None,
facet_field: str | None = None,
facet_text: str | None = None,
from_expiration_date: str | None = None,
from_lot_created_at: str | None = None,
from_on_hand: str | None = None,
gslo_group: str | list[str] | None = None,
idh: str | list[str] | None = None,
is_pop_up: bool | None = None,
lot_created_by: list[User]
| User
| str
| list[str]
| None = None,
material_category: str | list[str] | None = None,
pack_size: str | list[str] | None = None,
pictogram_name: str | list[str] | None = None,
result: str | list[str] | None = None,
rsn: str | list[str] | None = None,
source_field: str | list[str] | None = None,
status: str | list[str] | None = None,
sub_category: str | list[str] | None = None,
synthesis_product_created: str
| list[str]
| None = None,
to_expiration_date: str | None = None,
to_lot_created_at: str | None = None,
to_on_hand: str | None = None,
metadata_filters: dict[str, Any] | None = None,
custom_fields: dict[str, Any] | None = None,
additional_field: str | list[str] | None = None,
project_facets: dict[str, Any] | None = None,
composite_search: dict[str, Any] | None = None,
) -> Iterator[InventoryItem]
Get fully populated inventory items matching the given filters.
Accepts the same filters as search but returns complete
InventoryItem entities rather than lightweight search results. This is
slower because it fetches full detail for every match, so prefer
search when you only need names, IDs, or counts.
Filters are combined with OR logic by default; set
match_all_conditions=True to require every filter to match. Results are
returned as a lazily paginated iterator.
Example
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
Free-text query matched against item name, alias, and related fields. Only the first 50 characters are used. |
None
|
cas
|
Cas or list[Cas]
|
Filter by CAS number(s). |
None
|
category
|
InventoryCategory or list[InventoryCategory]
|
Filter by category: |
None
|
company
|
Company or list[Company]
|
Filter by manufacturing Company. |
None
|
location
|
Location or list[Location]
|
Filter by location. |
None
|
storage_location
|
StorageLocation or StorageLocationFilter or list[StorageLocation | StorageLocationFilter]
|
Filter by storage location. |
None
|
project_id
|
str
|
Filter by the project a formula belongs to (Formula items only). |
None
|
sheet_id
|
str
|
Filter by worksheet ID. |
None
|
created_by
|
User, list[User], str, or list[str]
|
Filter by creator. Accepts user display name(s) or UserId(s) (e.g.
|
None
|
lot_owner
|
User or list[User]
|
Filter by lot owner(s). |
None
|
tags
|
list[str]
|
Filter by tag name(s). |
None
|
match_all_conditions
|
bool
|
Require every filter to match (AND logic). Default False (OR logic). |
False
|
order
|
OrderBy
|
Sort direction. Default |
DESCENDING
|
sort_by
|
str
|
Field to sort by. Default None (server default order). |
None
|
max_items
|
int
|
Maximum number of items to return in total. If None, iterates over all matches. |
None
|
from_created_at
|
str
|
Only include items created on or after this date, formatted as
|
None
|
to_created_at
|
str
|
Only include items created on or before this date, formatted as
|
None
|
updated_by
|
str or list[str]
|
Filter by user(s) who last updated the item. Accepts UserId(s) only
(e.g. |
None
|
from_updated_at
|
str
|
Only include items updated on or after this date (ISO 8601). |
None
|
to_updated_at
|
str
|
Only include items updated on or before this date (ISO 8601). |
None
|
metadata_filters
|
dict[str, Any]
|
Filter by custom field (metadata) values. |
None
|
albert_id
|
str or list[str]
|
Filter by Albert ID(s). |
None
|
attribute_id
|
str or list[str]
|
Filter by attribute ID(s). Cannot be combined with |
None
|
cas_smile
|
str or list[str]
|
Filter by CAS SMILES string(s). |
None
|
collaborator_pop_up
|
bool
|
Apply collaborator popup search behavior. |
None
|
contains_field
|
str or list[str]
|
Field(s) for contains-style filtering. |
None
|
contains_text
|
str or list[str]
|
Text value(s) paired with |
None
|
created_by_id
|
str or list[str]
|
Filter by creator UserId(s). |
None
|
details
|
bool
|
Invoke custom logic for the worksheet details view. |
None
|
drop_down_text
|
str
|
Dropdown search text. |
None
|
drop_down_text_prop
|
str
|
Dropdown search property name. |
None
|
dup_detection
|
bool
|
Enable duplicate-detection text sanitization. |
None
|
facet_field
|
str
|
Facet field to filter on. |
None
|
facet_text
|
str
|
Facet text to match. |
None
|
from_expiration_date
|
str
|
Only include lots expiring on or after this date ( |
None
|
from_lot_created_at
|
str
|
Only include lots created on or after this date ( |
None
|
from_on_hand
|
str
|
Minimum on-hand quantity filter. |
None
|
gslo_group
|
str or list[str]
|
Filter by GSLO group(s). |
None
|
idh
|
str or list[str]
|
Filter by IDH value(s). |
None
|
is_pop_up
|
bool
|
Apply popup search behavior. |
None
|
lot_created_by
|
User, list[User], str, or list[str]
|
Filter by lot creator. Accepts display name(s), UserId(s), or
|
None
|
material_category
|
str or list[str]
|
Filter by material category. |
None
|
pack_size
|
str or list[str]
|
Filter by pack size. |
None
|
pictogram_name
|
str or list[str]
|
Filter by pictogram name(s). |
None
|
result
|
str or list[str]
|
Filter by result value(s). |
None
|
rsn
|
str or list[str]
|
Filter by RSN value(s). |
None
|
source_field
|
str or list[str]
|
Restrict which fields are returned in search results. |
None
|
status
|
str or list[str]
|
Filter by status value(s). |
None
|
sub_category
|
str or list[str]
|
Filter by sub-category. |
None
|
synthesis_product_created
|
str or list[str]
|
Filter by synthesis product creation value(s). |
None
|
to_expiration_date
|
str
|
Only include lots expiring on or before this date ( |
None
|
to_lot_created_at
|
str
|
Only include lots created on or before this date ( |
None
|
to_on_hand
|
str
|
Maximum on-hand quantity filter. |
None
|
custom_fields
|
dict[str, Any]
|
Filter by custom field values. |
None
|
additional_field
|
str or list[str]
|
Request additional columns from the search index. |
None
|
project_facets
|
dict[str, Any]
|
Project facet filters. |
None
|
composite_search
|
dict[str, Any]
|
Composite search specification. |
None
|
Returns:
| Type | Description |
|---|---|
Iterator[InventoryItem]
|
A lazily paginated iterator of fully populated items. |
Source code in src/albert/collections/inventory.py
1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 | |
update
update(*, inventory_item: InventoryItem) -> InventoryItem
Update an existing inventory item.
Fetch the item (e.g. with get_by_id), modify the updatable fields
on the returned object, then pass it here. Only the fields listed in Notes
are applied; changes to other fields are ignored.
Example
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
inventory_item
|
InventoryItem
|
The item to update. Must have a valid |
required |
Returns:
| Type | Description |
|---|---|
InventoryItem
|
The updated item. |
Notes
The following fields can be updated: alias, description,
is_formula_override, metadata, name, security_class,
unit_category.
On individual CAS entries (via cas): min, max, target,
cas_category, inventory_function.
substance_id can be set when adding a new CAS entry; it is not
patchable on existing entries.
Source code in src/albert/collections/inventory.py
1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 | |