Skip to content

Lots

albert.resources.lots

LotStatus

Bases: str, Enum

The status of a lot

Attributes:

Name Type Description
ACTIVE
INACTIVE
QUARANTINED

ACTIVE

ACTIVE = 'active'

INACTIVE

INACTIVE = 'inactive'

QUARANTINED

QUARANTINED = 'quarantined'

Lot

Bases: BaseResource

A lot in Albert.

Attributes:

Name Type Description
id LotId | None

The Albert ID of the lot. Set when the lot is retrieved from Albert.

inventory_id InventoryId

The Albert ID of the inventory item associated with the lot.

task_id str | None

The Albert ID of the task associated with the creation of lot. Optional.

notes str | None

The notes associated with the lot. Optional.

expiration_date str | None

The expiration date of the lot. YYYY-MM-DD format. Optional.

manufacturer_lot_number str | None

The manufacturer lot number of the lot. Optional.

storage_location StorageLocation | None

The storage location of the lot. Optional.

pack_size str | None

The pack size of the lot. Optional. Used to calculate the cost per unit.

initial_quantity NonNegativeFloat | None

The initial quantity of the lot. Optional.

cost NonNegativeFloat | None

The cost of the lot. Optional.

inventory_on_hand NonNegativeFloat

The inventory on hand of the lot.

owner list[User] | None

The owners of the lot. Optional.

lot_number str | None

The lot number of the lot. Optional.

external_barcode_id str | None

The external barcode ID of the lot. Optional.

metadata dict[str, str | list[EntityLink] | EntityLink] | None

The metadata of the lot. Optional. Metadata allowed values can be found using the Custom Fields API.

has_notes bool

Whether the lot has notes. Read-only.

has_attachments bool

Whether the lot has attachments. Read-only.

barcode_id str

The barcode ID of the lot. Read-only.

Methods:

Name Description
validate_has_notes
validate_has_attachments
serialize_initial_quantity
serialize_cost
serialize_inventory_on_hand

id

id: LotId | None = Field(None, alias='albertId')

inventory_id

inventory_id: InventoryId = Field(alias='parentId')

task_id

task_id: str | None = Field(default=None, alias='taskId')

expiration_date

expiration_date: str | None = Field(
    None, alias="expirationDate"
)

manufacturer_lot_number

manufacturer_lot_number: str | None = Field(
    None, alias="manufacturerLotNumber"
)

storage_location

storage_location: (
    SerializeAsEntityLink[StorageLocation] | None
) = Field(alias="StorageLocation", default=None)

pack_size

pack_size: str | None = Field(None, alias='packSize')

initial_quantity

initial_quantity: NonNegativeFloat | None = Field(
    default=None, alias="initialQuantity"
)

cost

cost: NonNegativeFloat | None = Field(default=None)

inventory_on_hand

inventory_on_hand: float = Field(alias='inventoryOnHand')

owner

owner: list[SerializeAsEntityLink[User]] | None = Field(
    default=None, alias="Owner"
)

lot_number

lot_number: str | None = Field(None, alias='lotNumber')

external_barcode_id

external_barcode_id: str | None = Field(
    None, alias="externalBarcodeId"
)

metadata

metadata: dict[str, MetadataItem] | None = Field(
    alias="Metadata", default=None
)

status

status: LotStatus | None = Field(default=None)

location

location: SerializeAsEntityLink[Location] | None = Field(
    default=None,
    alias="Location",
    exclude=True,
    frozen=True,
)

notes

notes: str | None = Field(
    default=None, exclude=True, frozen=True
)

has_notes

has_notes: bool | None = Field(
    default=None,
    alias="hasNotes",
    exclude=True,
    frozen=True,
)

has_attachments

has_attachments: bool | None = Field(
    default=None,
    alias="hasAttachments",
    exclude=True,
    frozen=True,
)

parent_name

parent_name: str | None = Field(
    default=None,
    alias="parentName",
    exclude=True,
    frozen=True,
)

parent_unit

parent_unit: str | None = Field(
    default=None,
    alias="parentUnit",
    exclude=True,
    frozen=True,
)

parent_category

parent_category: InventoryCategory | None = Field(
    default=None,
    alias="parentCategory",
    exclude=True,
    frozen=True,
)

barcode_id

barcode_id: str | None = Field(
    default=None, alias="barcodeId"
)

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)
def serialize_initial_quantity(self, initial_quantity: NonNegativeFloat):
    return str(initial_quantity)

serialize_cost

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

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 str(inventory_on_hand)