Skip to content

Lots

albert.resources.lots

LotStatus

Bases: str, Enum

The lifecycle status of a lot.

Attributes:

Name Type Description
ACTIVE

The lot is in normal use.

INACTIVE

The lot is no longer in use.

QUARANTINED

The lot is held back from use (e.g. pending inspection).

ACTIVE

ACTIVE = 'active'

INACTIVE

INACTIVE = 'inactive'

QUARANTINED

QUARANTINED = 'quarantined'

LotAdjustmentAction

Bases: str, Enum

How a quantity adjustment is applied to a lot's inventory on hand.

Used with adjust.

Attributes:

Name Type Description
ADD

Increase inventory on hand by the given quantity.

SUBTRACT

Decrease inventory on hand by the given quantity.

SET

Set inventory on hand to exactly the given quantity.

ZERO

Set inventory on hand to zero.

ADD

ADD = 'ADD'

SUBTRACT

SUBTRACT = 'SUBTRACT'

SET

SET = 'SET'

ZERO

ZERO = 'ZERO'

InventoryOnHandFilter

Bases: str, Enum

Filter lots by inventory on hand relative to zero.

Used with get_all.

Attributes:

Name Type Description
LTE_ZERO

On hand is less than or equal to zero.

GT_ZERO

On hand is greater than zero.

EQ_ZERO

On hand equals zero.

LTE_ZERO

LTE_ZERO = 'lteZero'

GT_ZERO

GT_ZERO = 'gtZero'

EQ_ZERO

EQ_ZERO = 'eqZero'

Bases: BaseAlbertModel

A workflow associated with a lot.

Show JSON schema:
{
  "description": "A workflow associated with a lot.",
  "properties": {
    "id": {
      "description": "The workflow ID (format ``WFL...``).",
      "title": "Id",
      "type": "string"
    },
    "category": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Workflow category (e.g. ``FINAL``).",
      "title": "Category"
    }
  },
  "required": [
    "id"
  ],
  "title": "LotWorkflowLink",
  "type": "object"
}

Fields:

id

id: str

The workflow ID (format WFL...).

category

category: str | None = None

Workflow category (e.g. FINAL).

Lot

Bases: BaseResource

A specific physical batch or quantity of an Inventory Item.

A Lot represents one received shipment or produced amount of a parent Inventory Item (identified by inventory_id), tracking batch-specific details such as how much is currently on hand, where it is stored, its cost, and who owns it. Lots are managed through the Lot collection (LotCollection, accessed as client.lots); their parent items live in the Inventory collection (InventoryCollection). A lot_id is used throughout property data to scope results to a single batch.

A lot's own ID has the format LOT...; its parent inventory_id has the format INV....

Example

from albert import Albert
from albert.core.shared.models.base import EntityLink
from albert.resources.lots import Lot
client = Albert()
lot = Lot(
    inventory_id="INVA9999999",
    storage_location=EntityLink(id="STL9999999"),
    initial_quantity=10.0,
    inventory_on_hand=10.0,
    cost=50.0,
    manufacturer_lot_number="MLN-001",
)
created = client.lots.create(lots=[lot])
Notes

Fields required when creating a lot via create depend on the path:

  • Regular lot (no task_id): inventory_id, storage_location, initial_quantity, and inventory_on_hand (usually the same value as initial_quantity). When the parent Inventory Item is RawMaterials, cost and manufacturer_lot_number are also required.
  • Task lot (task_id set, batch / Formulas path): inventory_id and location (not storage_location).
Show JSON schema:
{
  "$defs": {
    "AuditFields": {
      "description": "The audit fields for a resource",
      "properties": {
        "by": {
          "default": null,
          "title": "By",
          "type": "string"
        },
        "byName": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Byname"
        },
        "at": {
          "anyOf": [
            {
              "format": "date-time",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "At"
        }
      },
      "title": "AuditFields",
      "type": "object"
    },
    "EntityLink": {
      "properties": {
        "id": {
          "title": "Id",
          "type": "string"
        },
        "name": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Name"
        },
        "category": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Category"
        }
      },
      "required": [
        "id"
      ],
      "title": "EntityLink",
      "type": "object"
    },
    "EntityLinkWithName": {
      "description": "EntityLink that includes the name field in serialization.",
      "properties": {
        "id": {
          "title": "Id",
          "type": "string"
        },
        "name": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Name"
        },
        "category": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Category"
        }
      },
      "required": [
        "id"
      ],
      "title": "EntityLinkWithName",
      "type": "object"
    },
    "InventoryCategory": {
      "description": "The kind of material an [`InventoryItem`][albert.resources.inventory.InventoryItem] represents.\n\nEvery inventory item belongs to exactly one category, which determines how it\nis used across the platform and which fields are relevant to it.\n\nAttributes\n----------\nRAW_MATERIALS : str\n    A purchased substance used as an ingredient (e.g. a solvent or pigment).\n    Typically linked to a manufacturing ``company`` and one or more CAS numbers.\nCONSUMABLES : str\n    Lab supplies consumed during work (e.g. gloves, vials, filters).\nEQUIPMENT : str\n    Instruments and apparatus (e.g. a balance or spectrometer).\nFORMULAS : str\n    A mixture designed in Albert through a Worksheet. Formulas are not created\n    through the inventory collection; they are produced by the Worksheet\n    collection ([`WorksheetCollection`][albert.collections.worksheets.WorksheetCollection]).",
      "enum": [
        "RawMaterials",
        "Consumables",
        "Equipment",
        "Formulas"
      ],
      "title": "InventoryCategory",
      "type": "string"
    },
    "Location": {
      "description": "A physical lab or site location in Albert.\n\nLocations are referenced by Tasks and Inventory Items to record where an\nactivity is performed or where a material lives, and each Location can hold\none or more Storage Locations\n([`StorageLocation`][albert.resources.storage_locations.StorageLocation]). Managed\nthrough [`LocationCollection`][albert.collections.locations.LocationCollection].\n\n!!! example\n    ```python\n    from albert.resources.locations import Location\n    location = Location(\n        name=\"Boston Lab\",\n        latitude=42.3601,\n        longitude=-71.0589,\n        address=\"1 Main St\",\n        country=\"US\",\n    )\n    ```",
      "properties": {
        "status": {
          "anyOf": [
            {
              "$ref": "#/$defs/Status"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The status of the resource, optional."
        },
        "Created": {
          "anyOf": [
            {
              "$ref": "#/$defs/AuditFields"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Audit fields for the creation of the resource, optional."
        },
        "Updated": {
          "anyOf": [
            {
              "$ref": "#/$defs/AuditFields"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Audit fields for the update of the resource, optional."
        },
        "name": {
          "description": "The human-readable name of the location.",
          "title": "Name",
          "type": "string"
        },
        "albertId": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The Albert ID of the location. Assigned by Albert and populated once the location has been created or retrieved.",
          "title": "Albertid"
        },
        "latitude": {
          "description": "The latitude of the location, in decimal degrees.",
          "title": "Latitude",
          "type": "number"
        },
        "longitude": {
          "description": "The longitude of the location, in decimal degrees.",
          "title": "Longitude",
          "type": "number"
        },
        "address": {
          "description": "The street address of the location.",
          "title": "Address",
          "type": "string"
        },
        "country": {
          "anyOf": [
            {
              "maxLength": 2,
              "minLength": 2,
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The two-letter country code of the location (for example, ``\"US\"``).",
          "title": "Country"
        }
      },
      "required": [
        "name",
        "latitude",
        "longitude",
        "address"
      ],
      "title": "Location",
      "type": "object"
    },
    "LotStatus": {
      "description": "The lifecycle status of a lot.\n\nAttributes\n----------\nACTIVE\n    The lot is in normal use.\nINACTIVE\n    The lot is no longer in use.\nQUARANTINED\n    The lot is held back from use (e.g. pending inspection).",
      "enum": [
        "active",
        "inactive",
        "quarantined"
      ],
      "title": "LotStatus",
      "type": "string"
    },
    "LotWorkflowLink": {
      "description": "A workflow associated with a lot.",
      "properties": {
        "id": {
          "description": "The workflow ID (format ``WFL...``).",
          "title": "Id",
          "type": "string"
        },
        "category": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Workflow category (e.g. ``FINAL``).",
          "title": "Category"
        }
      },
      "required": [
        "id"
      ],
      "title": "LotWorkflowLink",
      "type": "object"
    },
    "Role": {
      "description": "A named set of access permissions within a tenant.\n\nA role bundles policies that determine what a holder is allowed to do. Roles\nare assigned to users ([`User`][albert.resources.users.User]) and referenced\nby entity ACLs. Roles are typically read from Albert rather than built by\nhand.",
      "properties": {
        "status": {
          "anyOf": [
            {
              "$ref": "#/$defs/Status"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The status of the resource, optional."
        },
        "Created": {
          "anyOf": [
            {
              "$ref": "#/$defs/AuditFields"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Audit fields for the creation of the resource, optional."
        },
        "Updated": {
          "anyOf": [
            {
              "$ref": "#/$defs/AuditFields"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Audit fields for the update of the resource, optional."
        },
        "albertId": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The Albert ID of the role. Role IDs may contain ``#`` characters. Set once the role is retrieved from Albert.",
          "title": "Albertid"
        },
        "name": {
          "description": "The display name of the role.",
          "title": "Name",
          "type": "string"
        },
        "Policies": {
          "anyOf": [
            {
              "items": {},
              "type": "array"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The policies (permission rules) associated with the role.",
          "title": "Policies"
        },
        "tenant": {
          "description": "The ID of the tenant the role belongs to.",
          "title": "Tenant",
          "type": "string"
        },
        "visibility": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Whether the role is visible in the platform's role listings.",
          "title": "Visibility"
        }
      },
      "required": [
        "name",
        "tenant"
      ],
      "title": "Role",
      "type": "object"
    },
    "Status": {
      "description": "The status of a resource.\n\nAttributes\n----------\nACTIVE : str\n    The resource is fully operational and visible in normal operations.\nINACTIVE : str\n    The resource is hidden from normal operations and disabled from use.",
      "enum": [
        "active",
        "inactive"
      ],
      "title": "Status",
      "type": "string"
    },
    "StorageLocation": {
      "description": "A specific place where an Inventory Item is physically stored.\n\nExamples include a flammables cabinet, a freezer, or a storeroom shelf. Every\nstorage location belongs to a parent Location\n([`Location`][albert.resources.locations.Location]), and Inventory search filters\ncan narrow results to items held in a given storage location. Managed through\n[`StorageLocationsCollection`][albert.collections.storage_locations.StorageLocationsCollection].\n\n!!! example\n    ```python\n    from albert import Albert\n    from albert.resources.storage_locations import StorageLocation\n    client = Albert()\n    parent = client.locations.get_by_id(id=\"...\")\n    storage_location = StorageLocation(name=\"Freezer A\", location=parent)\n    ```",
      "properties": {
        "status": {
          "anyOf": [
            {
              "$ref": "#/$defs/Status"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The status of the resource, optional."
        },
        "Created": {
          "anyOf": [
            {
              "$ref": "#/$defs/AuditFields"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Audit fields for the creation of the resource, optional."
        },
        "Updated": {
          "anyOf": [
            {
              "$ref": "#/$defs/AuditFields"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Audit fields for the update of the resource, optional."
        },
        "name": {
          "description": "The human-readable name of the storage location (2 to 255 characters).",
          "maxLength": 255,
          "minLength": 2,
          "title": "Name",
          "type": "string"
        },
        "albertId": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The Albert ID of the storage location (format ``STL...``). Assigned by Albert and populated once the storage location has been created or retrieved.",
          "title": "Albertid"
        },
        "Location": {
          "anyOf": [
            {
              "$ref": "#/$defs/Location"
            },
            {
              "$ref": "#/$defs/EntityLink"
            }
          ],
          "description": "The parent Location this storage location belongs to.",
          "title": "Location"
        }
      },
      "required": [
        "name",
        "Location"
      ],
      "title": "StorageLocation",
      "type": "object"
    },
    "User": {
      "description": "An Albert user account: a person who can log in and act in the platform.\n\nA user has a name and email, an optional home\n[`Location`][albert.resources.locations.Location], and a set of\n[`Role`][albert.resources.roles.Role] objects that govern what they can do.\nThe ``user_class`` sets a broad permission tier\n([`UserClass`][albert.resources.users.UserClass]). Users are grouped into teams\n([`Team`][albert.resources.teams.Team]), and are referenced across the\nplatform, for example as the assignee of a Task or in an entity's ACL.\n\n!!! example\n    ```python\n    from albert.resources.users import User, UserClass\n    user = User(\n        name=\"Ada Lovelace\",\n        email=\"ada@example.com\",\n        user_class=UserClass.STANDARD,\n    )\n    ```",
      "properties": {
        "status": {
          "anyOf": [
            {
              "$ref": "#/$defs/Status"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The status of the resource, optional."
        },
        "Created": {
          "anyOf": [
            {
              "$ref": "#/$defs/AuditFields"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Audit fields for the creation of the resource, optional."
        },
        "Updated": {
          "anyOf": [
            {
              "$ref": "#/$defs/AuditFields"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Audit fields for the update of the resource, optional."
        },
        "name": {
          "description": "The display name of the user.",
          "title": "Name",
          "type": "string"
        },
        "albertId": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The Albert User ID (format ``USR...``). Set once the user is registered in or retrieved from Albert.",
          "title": "Albertid"
        },
        "Location": {
          "anyOf": [
            {
              "$ref": "#/$defs/Location"
            },
            {
              "$ref": "#/$defs/EntityLink"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The user's home location.",
          "title": "Location"
        },
        "email": {
          "default": null,
          "description": "The user's email address.",
          "format": "email",
          "title": "Email",
          "type": "string"
        },
        "Roles": {
          "description": "The roles the user holds, which determine their permissions.",
          "items": {
            "anyOf": [
              {
                "$ref": "#/$defs/Role"
              },
              {
                "$ref": "#/$defs/EntityLink"
              }
            ]
          },
          "maxItems": 1,
          "title": "Roles",
          "type": "array"
        },
        "userClass": {
          "$ref": "#/$defs/UserClass",
          "default": "standard",
          "description": "The ACL class level of the user (broad permission tier)."
        },
        "witnesser": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Whether the user can act as a witness on tasks (only relevant when witnessing is enabled for the tenant).",
          "title": "Witnesser"
        },
        "Metadata": {
          "anyOf": [
            {
              "additionalProperties": {
                "anyOf": [
                  {
                    "type": "number"
                  },
                  {
                    "type": "integer"
                  },
                  {
                    "type": "string"
                  },
                  {
                    "$ref": "#/$defs/EntityLinkWithName"
                  },
                  {
                    "$ref": "#/$defs/EntityLink"
                  },
                  {
                    "items": {
                      "anyOf": [
                        {
                          "$ref": "#/$defs/EntityLinkWithName"
                        },
                        {
                          "$ref": "#/$defs/EntityLink"
                        }
                      ]
                    },
                    "type": "array"
                  }
                ]
              },
              "type": "object"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Custom metadata attached to the user.",
          "title": "Metadata"
        }
      },
      "required": [
        "name"
      ],
      "title": "User",
      "type": "object"
    },
    "UserClass": {
      "description": "The ACL class level of a user, setting a broad permission tier.\n\nAttributes\n----------\nGUEST : str\n    Most limited access; typically external or temporary users.\nSTANDARD : str\n    Default access level for regular users.\nTRUSTED : str\n    Elevated access above standard users.\nPRIVILEGED : str\n    High access level below full administrators.\nADMIN : str\n    Full administrative access to the tenant.",
      "enum": [
        "guest",
        "standard",
        "trusted",
        "privileged",
        "admin"
      ],
      "title": "UserClass",
      "type": "string"
    }
  },
  "description": "A specific physical batch or quantity of an Inventory Item.\n\nA Lot represents one received shipment or produced amount of a parent\nInventory Item (identified by ``inventory_id``), tracking batch-specific\ndetails such as how much is currently on hand, where it is stored, its cost,\nand who owns it. Lots are managed through the Lot collection\n([`LotCollection`][albert.collections.lots.LotCollection], accessed as\n``client.lots``); their parent items live in the Inventory collection\n([`InventoryCollection`][albert.collections.inventory.InventoryCollection]). A ``lot_id``\nis used throughout property data to scope results to a single batch.\n\nA lot's own ID has the format ``LOT...``; its parent ``inventory_id`` has the\nformat ``INV...``.\n\n!!! example\n    ```python\n    from albert import Albert\n    from albert.core.shared.models.base import EntityLink\n    from albert.resources.lots import Lot\n    client = Albert()\n    lot = Lot(\n        inventory_id=\"INVA9999999\",\n        storage_location=EntityLink(id=\"STL9999999\"),\n        initial_quantity=10.0,\n        inventory_on_hand=10.0,\n        cost=50.0,\n        manufacturer_lot_number=\"MLN-001\",\n    )\n    created = client.lots.create(lots=[lot])\n    ```\n\nNotes\n-----\nFields required when creating a lot via\n[`create`][albert.collections.lots.LotCollection.create] depend on the path:\n\n- **Regular lot** (no ``task_id``): ``inventory_id``, ``storage_location``,\n  ``initial_quantity``, and ``inventory_on_hand`` (usually the same value as\n  ``initial_quantity``). When the parent Inventory Item is ``RawMaterials``,\n  ``cost`` and ``manufacturer_lot_number`` are also required.\n- **Task lot** (``task_id`` set, batch / ``Formulas`` path): ``inventory_id``\n  and ``location`` (not ``storage_location``).",
  "properties": {
    "status": {
      "anyOf": [
        {
          "$ref": "#/$defs/LotStatus"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The lot's lifecycle status. Read-only."
    },
    "Created": {
      "anyOf": [
        {
          "$ref": "#/$defs/AuditFields"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Audit fields for the creation of the resource, optional."
    },
    "Updated": {
      "anyOf": [
        {
          "$ref": "#/$defs/AuditFields"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Audit fields for the update of the resource, optional."
    },
    "action": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Internal marker for the operation that produced the lot (e.g. a split). Not typically set by callers.",
      "title": "Action"
    },
    "albertId": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The lot's Albert ID (format ``LOT...``). Assigned by Albert; present on lots retrieved from the platform.",
      "title": "Albertid"
    },
    "parentId": {
      "description": "The Albert ID of the parent Inventory Item this lot is a batch of.\n\nRequired when creating a lot.",
      "title": "Parentid",
      "type": "string"
    },
    "taskId": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The Albert ID of the Task that produced this lot, if it came from one.\n\nWhen set, creation follows the task / batch (``Formulas``) path: provide\n``location`` instead of ``storage_location``.",
      "title": "Taskid"
    },
    "workflowId": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The Albert ID of the workflow associated with this lot (format ``WFL...``).\n\nCan be set via [`update`][albert.collections.lots.LotCollection.update].",
      "title": "Workflowid"
    },
    "Workflows": {
      "anyOf": [
        {
          "items": {
            "$ref": "#/$defs/LotWorkflowLink"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Workflow associations for this lot. Read-only; use ``workflow_id``.",
      "title": "Workflows"
    },
    "expirationDate": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The date the lot expires, in ``YYYY-MM-DD`` format.",
      "title": "Expirationdate"
    },
    "manufacturerLotNumber": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The manufacturer's own lot number for this batch.\n\nRequired when creating a lot whose parent Inventory Item is ``RawMaterials``\n(and ``task_id`` is not set). Optional on read and update.",
      "title": "Manufacturerlotnumber"
    },
    "StorageLocation": {
      "anyOf": [
        {
          "$ref": "#/$defs/StorageLocation"
        },
        {
          "$ref": "#/$defs/EntityLink"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The specific place within a location where the lot is stored (e.g. a bin, cabinet, or hood).\n\nWhen creating or updating, pass an [`EntityLink`][albert.core.shared.models.base.EntityLink]\nwith the storage location ID (format ``STL...``), or a fully populated\n[`StorageLocation`][albert.resources.storage_locations.StorageLocation].\nDo not construct ``StorageLocation`` with only ``id``/``name``; ``location`` is required\non that model.",
      "title": "Storagelocation"
    },
    "packSize": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The pack size of the lot, used to calculate cost per unit.",
      "title": "Packsize"
    },
    "initialQuantity": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The quantity the lot started with, in the parent item's units.\n\nRequired when creating a non-task lot (no ``task_id``).",
      "title": "Initialquantity"
    },
    "cost": {
      "anyOf": [
        {
          "minimum": 0,
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The cost of the lot.\n\nRequired when creating a lot whose parent Inventory Item is ``RawMaterials``\n(and ``task_id`` is not set). Optional on read and update.",
      "title": "Cost"
    },
    "inventoryOnHand": {
      "description": "The quantity currently in stock, in the parent item's units.\n\nRequired when creating a non-task lot; set to the starting stock (usually the\nsame value as ``initial_quantity``). After creation, change it with\n[`adjust`][albert.collections.lots.LotCollection.adjust] rather than by\nediting directly.",
      "title": "Inventoryonhand",
      "type": "number"
    },
    "Owner": {
      "anyOf": [
        {
          "items": {
            "anyOf": [
              {
                "$ref": "#/$defs/User"
              },
              {
                "$ref": "#/$defs/EntityLink"
              }
            ]
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The user(s) who own the lot. A lot may have at most one owner.",
      "title": "Owner"
    },
    "lotNumber": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The lot's number within Albert.",
      "title": "Lotnumber"
    },
    "externalBarcodeId": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "An external barcode ID for the lot.",
      "title": "Externalbarcodeid"
    },
    "Metadata": {
      "anyOf": [
        {
          "additionalProperties": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "integer"
              },
              {
                "type": "string"
              },
              {
                "$ref": "#/$defs/EntityLinkWithName"
              },
              {
                "$ref": "#/$defs/EntityLink"
              },
              {
                "items": {
                  "anyOf": [
                    {
                      "$ref": "#/$defs/EntityLinkWithName"
                    },
                    {
                      "$ref": "#/$defs/EntityLink"
                    }
                  ]
                },
                "type": "array"
              }
            ]
          },
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Custom field values for the lot. Allowed keys and values are defined by the Custom Fields configuration.",
      "title": "Metadata"
    },
    "notes": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Free-text notes on the lot.",
      "title": "Notes"
    },
    "Location": {
      "anyOf": [
        {
          "$ref": "#/$defs/Location"
        },
        {
          "$ref": "#/$defs/EntityLink"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The site/campus the lot is at (may contain multiple buildings, each with many storage locations).\n\nRequired when creating a task lot (``task_id`` set). Read-only on lots returned\nfrom GET; use ``storage_location`` for regular (non-task) lot creation.",
      "title": "Location"
    },
    "hasNotes": {
      "anyOf": [
        {
          "type": "boolean"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Whether the lot has notes. Read-only.",
      "title": "Hasnotes"
    },
    "hasAttachments": {
      "anyOf": [
        {
          "type": "boolean"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Whether the lot has attachments. Read-only.",
      "title": "Hasattachments"
    },
    "parentName": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The name of the parent Inventory Item. Read-only.",
      "title": "Parentname"
    },
    "parentUnit": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The unit of measure of the parent Inventory Item. Read-only.",
      "title": "Parentunit"
    },
    "parentCategory": {
      "anyOf": [
        {
          "$ref": "#/$defs/InventoryCategory"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The category of the parent Inventory Item (e.g. ``RawMaterials``). Read-only."
    },
    "barcodeId": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The barcode ID assigned by Albert. Read-only.",
      "title": "Barcodeid"
    },
    "taskCompletionDate": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The completion date of the Task that produced the lot. Read-only.",
      "title": "Taskcompletiondate"
    }
  },
  "required": [
    "parentId",
    "inventoryOnHand"
  ],
  "title": "Lot",
  "type": "object"
}

Fields:

Validators:

action

action: str | None = None

Internal marker for the operation that produced the lot (e.g. a split). Not typically set by callers.

id

id: LotId | None = None

The lot's Albert ID (format LOT...). Assigned by Albert; present on lots retrieved from the platform.

inventory_id

inventory_id: InventoryId

The Albert ID of the parent Inventory Item this lot is a batch of.

Required when creating a lot.

task_id

task_id: str | None = None

The Albert ID of the Task that produced this lot, if it came from one.

When set, creation follows the task / batch (Formulas) path: provide location instead of storage_location.

workflow_id

workflow_id: WorkflowId | None = None

The Albert ID of the workflow associated with this lot (format WFL...).

Can be set via update.

workflows

workflows: list[LotWorkflowLink] | None = None

Workflow associations for this lot. Read-only; use workflow_id.

expiration_date

expiration_date: str | None = None

The date the lot expires, in YYYY-MM-DD format.

manufacturer_lot_number

manufacturer_lot_number: str | None = None

The manufacturer's own lot number for this batch.

Required when creating a lot whose parent Inventory Item is RawMaterials (and task_id is not set). Optional on read and update.

storage_location

storage_location: (
    SerializeAsEntityLink[StorageLocation] | None
) = None

The specific place within a location where the lot is stored (e.g. a bin, cabinet, or hood).

When creating or updating, pass an EntityLink with the storage location ID (format STL...), or a fully populated StorageLocation. Do not construct StorageLocation with only id/name; location is required on that model.

pack_size

pack_size: str | None = None

The pack size of the lot, used to calculate cost per unit.

initial_quantity

initial_quantity: float | None = None

The quantity the lot started with, in the parent item's units.

Required when creating a non-task lot (no task_id).

cost

cost: NonNegativeFloat | None = None

The cost of the lot.

Required when creating a lot whose parent Inventory Item is RawMaterials (and task_id is not set). Optional on read and update.

inventory_on_hand

inventory_on_hand: float

The quantity currently in stock, in the parent item's units.

Required when creating a non-task lot; set to the starting stock (usually the same value as initial_quantity). After creation, change it with adjust rather than by editing directly.

owner

owner: list[SerializeAsEntityLink[User]] | None = None

The user(s) who own the lot. A lot may have at most one owner.

lot_number

lot_number: str | None = None

The lot's number within Albert.

external_barcode_id

external_barcode_id: str | None = None

An external barcode ID for the lot.

metadata

metadata: dict[str, MetadataItem] | None = None

Custom field values for the lot. Allowed keys and values are defined by the Custom Fields configuration.

notes

notes: str | None = None

Free-text notes on the lot.

status

status: LotStatus | None = None

The lot's lifecycle status. Read-only.

location

location: SerializeAsEntityLink[Location] | None = None

The site/campus the lot is at (may contain multiple buildings, each with many storage locations).

Required when creating a task lot (task_id set). Read-only on lots returned from GET; use storage_location for regular (non-task) lot creation.

has_notes

has_notes: bool | None = None

Whether the lot has notes. Read-only.

has_attachments

has_attachments: bool | None = None

Whether the lot has attachments. Read-only.

parent_name

parent_name: str | None = None

The name of the parent Inventory Item. Read-only.

parent_unit

parent_unit: str | None = None

The unit of measure of the parent Inventory Item. Read-only.

parent_category

parent_category: InventoryCategory | None = None

The category of the parent Inventory Item (e.g. RawMaterials). Read-only.

barcode_id

barcode_id: str | None = None

The barcode ID assigned by Albert. Read-only.

task_completion_date

task_completion_date: str | None = None

The completion date of the Task that produced the lot. Read-only.

populate_workflow_id_from_workflows

populate_workflow_id_from_workflows(data: Any) -> Any
Source code in src/albert/resources/lots.py
@model_validator(mode="before")
@classmethod
def populate_workflow_id_from_workflows(cls, data: Any) -> Any:
    if not isinstance(data, dict):
        return data
    if data.get("workflowId") or data.get("workflow_id"):
        return data
    workflows = data.get("Workflows") or data.get("workflows")
    if not workflows:
        return data
    final = next(
        (
            w
            for w in workflows
            if (w.get("category") if isinstance(w, dict) else w.category) == "FINAL"
        ),
        None,
    )
    link = final or workflows[0]
    workflow_id = link.get("id") if isinstance(link, dict) else link.id
    return {**data, "workflowId": workflow_id}

validate_has_notes

validate_has_notes(value: Any) -> Any
Source code in src/albert/resources/lots.py
@field_validator("has_notes", mode="before")
def validate_has_notes(cls, value: Any) -> Any:
    if value == "1":
        return True
    elif value == "0":
        return False
    return value

validate_has_attachments

validate_has_attachments(value: Any) -> Any
Source code in src/albert/resources/lots.py
@field_validator("has_attachments", mode="before")
def validate_has_attachments(cls, value: Any) -> Any:
    if value == "1":
        return True
    elif value == "0":
        return False
    return value

serialize_initial_quantity

serialize_initial_quantity(
    initial_quantity: NonNegativeFloat,
)
Source code in src/albert/resources/lots.py
@field_serializer("initial_quantity", return_type=str | None)
def serialize_initial_quantity(self, initial_quantity: NonNegativeFloat):
    return self._format_decimal(initial_quantity) if initial_quantity is not None else None

serialize_cost

serialize_cost(cost: NonNegativeFloat)
Source code in src/albert/resources/lots.py
@field_serializer("cost", return_type=str | None)
def serialize_cost(self, cost: NonNegativeFloat):
    return self._format_decimal(cost) if cost is not None else None

serialize_inventory_on_hand

serialize_inventory_on_hand(
    inventory_on_hand: NonNegativeFloat,
)
Source code in src/albert/resources/lots.py
@field_serializer("inventory_on_hand", return_type=str)
def serialize_inventory_on_hand(self, inventory_on_hand: NonNegativeFloat):
    return self._format_decimal(inventory_on_hand)

LotSearchItem

Bases: BaseAlbertModel, HydrationMixin[Lot]

Lightweight, partial view of a Lot returned by search.

Returned by search. It carries only the most commonly needed fields for fast lookups; call hydrate() to fetch the full Lot when you need every field.

Show JSON schema:
{
  "$defs": {
    "InventoryCategory": {
      "description": "The kind of material an [`InventoryItem`][albert.resources.inventory.InventoryItem] represents.\n\nEvery inventory item belongs to exactly one category, which determines how it\nis used across the platform and which fields are relevant to it.\n\nAttributes\n----------\nRAW_MATERIALS : str\n    A purchased substance used as an ingredient (e.g. a solvent or pigment).\n    Typically linked to a manufacturing ``company`` and one or more CAS numbers.\nCONSUMABLES : str\n    Lab supplies consumed during work (e.g. gloves, vials, filters).\nEQUIPMENT : str\n    Instruments and apparatus (e.g. a balance or spectrometer).\nFORMULAS : str\n    A mixture designed in Albert through a Worksheet. Formulas are not created\n    through the inventory collection; they are produced by the Worksheet\n    collection ([`WorksheetCollection`][albert.collections.worksheets.WorksheetCollection]).",
      "enum": [
        "RawMaterials",
        "Consumables",
        "Equipment",
        "Formulas"
      ],
      "title": "InventoryCategory",
      "type": "string"
    }
  },
  "description": "Lightweight, partial view of a [`Lot`][albert.resources.lots.Lot] returned by search.\n\nReturned by [`search`][albert.collections.lots.LotCollection.search]. It carries\nonly the most commonly needed fields for fast lookups; call\n`hydrate()` to fetch the full [`Lot`][albert.resources.lots.Lot] when you need every field.",
  "properties": {
    "albertId": {
      "description": "The lot's Albert ID (format ``LOT...``).",
      "title": "Albertid",
      "type": "string"
    },
    "parentId": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The Albert ID of the parent Inventory Item.",
      "title": "Parentid"
    },
    "parentName": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The name of the parent Inventory Item.",
      "title": "Parentname"
    },
    "parentUnit": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The unit of measure of the parent Inventory Item.",
      "title": "Parentunit"
    },
    "parentIdCategory": {
      "anyOf": [
        {
          "$ref": "#/$defs/InventoryCategory"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The category of the parent Inventory Item (e.g. ``RawMaterials``)."
    },
    "taskId": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The Albert ID of the Task that produced this lot, if any.",
      "title": "Taskid"
    },
    "barcodeId": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The barcode ID assigned by Albert.",
      "title": "Barcodeid"
    },
    "expirationDate": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The date the lot expires, in ``YYYY-MM-DD`` format.",
      "title": "Expirationdate"
    },
    "manufacturerLotNumber": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The manufacturer's own lot number for this batch.",
      "title": "Manufacturerlotnumber"
    },
    "number": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The lot's number within Albert.",
      "title": "Number"
    }
  },
  "required": [
    "albertId"
  ],
  "title": "LotSearchItem",
  "type": "object"
}

Fields:

id

id: LotId

The lot's Albert ID (format LOT...).

inventory_id

inventory_id: InventoryId | None = None

The Albert ID of the parent Inventory Item.

parent_name

parent_name: str | None = None

The name of the parent Inventory Item.

parent_unit

parent_unit: str | None = None

The unit of measure of the parent Inventory Item.

parent_category

parent_category: InventoryCategory | None = None

The category of the parent Inventory Item (e.g. RawMaterials).

task_id

task_id: str | None = None

The Albert ID of the Task that produced this lot, if any.

barcode_id

barcode_id: str | None = None

The barcode ID assigned by Albert.

expiration_date

expiration_date: str | None = None

The date the lot expires, in YYYY-MM-DD format.

manufacturer_lot_number

manufacturer_lot_number: str | None = None

The manufacturer's own lot number for this batch.

lot_number

lot_number: str | None = None

The lot's number within Albert.