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.

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"
        }
      },
      "required": [
        "id"
      ],
      "title": "EntityLink",
      "type": "object"
    },
    "InventoryCategory": {
      "enum": [
        "RawMaterials",
        "Consumables",
        "Equipment",
        "Formulas"
      ],
      "title": "InventoryCategory",
      "type": "string"
    },
    "Location": {
      "description": "A location in Albert.\n\nAttributes\n----------\nname : str\n    The name of the location.\nid : str | None\n    The Albert ID of the location. Set when the location is retrieved from Albert.\nlatitude : float\n    The latitude of the location.\nlongitude : float\n    The longitude of the location.\naddress : str\n    The address of the location.\ncountry : str | None\n    The country code of the location. Must be two characters long.",
      "properties": {
        "status": {
          "anyOf": [
            {
              "$ref": "#/$defs/Status"
            },
            {
              "type": "null"
            }
          ],
          "default": null
        },
        "Created": {
          "anyOf": [
            {
              "$ref": "#/$defs/AuditFields"
            },
            {
              "type": "null"
            }
          ],
          "default": null
        },
        "Updated": {
          "anyOf": [
            {
              "$ref": "#/$defs/AuditFields"
            },
            {
              "type": "null"
            }
          ],
          "default": null
        },
        "name": {
          "title": "Name",
          "type": "string"
        },
        "albertId": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Albertid"
        },
        "latitude": {
          "title": "Latitude",
          "type": "number"
        },
        "longitude": {
          "title": "Longitude",
          "type": "number"
        },
        "address": {
          "title": "Address",
          "type": "string"
        },
        "country": {
          "anyOf": [
            {
              "maxLength": 2,
              "minLength": 2,
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Country"
        }
      },
      "required": [
        "name",
        "latitude",
        "longitude",
        "address"
      ],
      "title": "Location",
      "type": "object"
    },
    "LotStatus": {
      "description": "The status of a lot",
      "enum": [
        "active",
        "inactive",
        "quarantined"
      ],
      "title": "LotStatus",
      "type": "string"
    },
    "Role": {
      "description": "A role in Albert. Note: Roles are not currently creatable via the SDK.\n\nAttributes\n----------\nname : str\n    The name of the role.\nid : str\n    The Albert ID of the role. Set when the role is retrieved from Albert.\npolicies : list[Any] | None\n    The policies associated with the role.\ntenant : str\n    The tenant ID of the role.",
      "properties": {
        "status": {
          "anyOf": [
            {
              "$ref": "#/$defs/Status"
            },
            {
              "type": "null"
            }
          ],
          "default": null
        },
        "Created": {
          "anyOf": [
            {
              "$ref": "#/$defs/AuditFields"
            },
            {
              "type": "null"
            }
          ],
          "default": null
        },
        "Updated": {
          "anyOf": [
            {
              "$ref": "#/$defs/AuditFields"
            },
            {
              "type": "null"
            }
          ],
          "default": null
        },
        "albertId": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Albertid"
        },
        "name": {
          "title": "Name",
          "type": "string"
        },
        "policies": {
          "anyOf": [
            {
              "items": {},
              "type": "array"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Policies"
        },
        "tenant": {
          "title": "Tenant",
          "type": "string"
        }
      },
      "required": [
        "name",
        "tenant"
      ],
      "title": "Role",
      "type": "object"
    },
    "Status": {
      "description": "The status of a resource",
      "enum": [
        "active",
        "inactive"
      ],
      "title": "Status",
      "type": "string"
    },
    "StorageLocation": {
      "description": "A storage location entity. For example, a specific flammables cabinet or a storage room.\n\nAttributes\n----------\nname : str\n    The name of the storage location.\nid : str | None\n    The Albert ID of the storage location. Set when the storage location is retrieved from Albert.\nlocation : Location\n    The location entity link of the storage location.",
      "properties": {
        "status": {
          "anyOf": [
            {
              "$ref": "#/$defs/Status"
            },
            {
              "type": "null"
            }
          ],
          "default": null
        },
        "Created": {
          "anyOf": [
            {
              "$ref": "#/$defs/AuditFields"
            },
            {
              "type": "null"
            }
          ],
          "default": null
        },
        "Updated": {
          "anyOf": [
            {
              "$ref": "#/$defs/AuditFields"
            },
            {
              "type": "null"
            }
          ],
          "default": null
        },
        "name": {
          "maxLength": 255,
          "minLength": 2,
          "title": "Name",
          "type": "string"
        },
        "albertId": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Albertid"
        },
        "Location": {
          "anyOf": [
            {
              "$ref": "#/$defs/Location"
            },
            {
              "$ref": "#/$defs/EntityLink"
            }
          ],
          "title": "Location"
        }
      },
      "required": [
        "name",
        "Location"
      ],
      "title": "StorageLocation",
      "type": "object"
    },
    "User": {
      "description": "Represents a User on the Albert Platform\n\nAttributes\n----------\nname : str\n    The name of the user.\nid : str | None\n    The Albert ID of the user. Set when the user is retrieved from Albert.\nlocation : Location | None\n    The location of the user.\nemail : EmailStr | None\n    The email of the user.\nroles : list[Role]\n    The roles of the user.\nuser_class : UserClass\n    The ACL class level of the user.\nmetadata : dict[str, str | list[EntityLink] | EntityLink] | None",
      "properties": {
        "status": {
          "anyOf": [
            {
              "$ref": "#/$defs/Status"
            },
            {
              "type": "null"
            }
          ],
          "default": null
        },
        "Created": {
          "anyOf": [
            {
              "$ref": "#/$defs/AuditFields"
            },
            {
              "type": "null"
            }
          ],
          "default": null
        },
        "Updated": {
          "anyOf": [
            {
              "$ref": "#/$defs/AuditFields"
            },
            {
              "type": "null"
            }
          ],
          "default": null
        },
        "name": {
          "title": "Name",
          "type": "string"
        },
        "albertId": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Albertid"
        },
        "Location": {
          "anyOf": [
            {
              "$ref": "#/$defs/Location"
            },
            {
              "$ref": "#/$defs/EntityLink"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Location"
        },
        "email": {
          "default": null,
          "format": "email",
          "title": "Email",
          "type": "string"
        },
        "Roles": {
          "items": {
            "anyOf": [
              {
                "$ref": "#/$defs/Role"
              },
              {
                "$ref": "#/$defs/EntityLink"
              }
            ]
          },
          "maxItems": 1,
          "title": "Roles",
          "type": "array"
        },
        "userClass": {
          "$ref": "#/$defs/UserClass",
          "default": "standard"
        },
        "Metadata": {
          "anyOf": [
            {
              "additionalProperties": {
                "anyOf": [
                  {
                    "type": "number"
                  },
                  {
                    "type": "integer"
                  },
                  {
                    "type": "string"
                  },
                  {
                    "$ref": "#/$defs/EntityLink"
                  },
                  {
                    "items": {
                      "$ref": "#/$defs/EntityLink"
                    },
                    "type": "array"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "type": "object"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Metadata"
        }
      },
      "required": [
        "name"
      ],
      "title": "User",
      "type": "object"
    },
    "UserClass": {
      "description": "The ACL class level of the user",
      "enum": [
        "guest",
        "standard",
        "trusted",
        "privileged",
        "admin"
      ],
      "title": "UserClass",
      "type": "string"
    }
  },
  "description": "A lot in Albert.\n\nAttributes\n----------\nid : LotId | None\n    The Albert ID of the lot. Set when the lot is retrieved from Albert.\ninventory_id : InventoryId\n    The Albert ID of the inventory item associated with the lot.\ntask_id : str | None\n    The Albert ID of the task associated with the creation of lot. Optional.\nnotes : str | None\n    The notes associated with the lot. Optional.\nexpiration_date : str | None\n    The expiration date of the lot. YYYY-MM-DD format. Optional.\nmanufacturer_lot_number : str | None\n    The manufacturer lot number of the lot. Optional.\nstorage_location : StorageLocation | None\n    The storage location of the lot. Optional.\npack_size : str | None\n    The pack size of the lot. Optional. Used to calculate the cost per unit.\ninitial_quantity : NonNegativeFloat | None\n    The initial quantity of the lot. Optional.\ncost : NonNegativeFloat | None\n    The cost of the lot. Optional.\ninventory_on_hand : NonNegativeFloat\n    The inventory on hand of the lot.\nowner : list[User] | None\n    The owners of the lot. Optional.\nlot_number : str | None\n    The lot number of the lot. Optional.\nexternal_barcode_id : str | None\n    The external barcode ID of the lot. Optional.\nmetadata : dict[str, str | list[EntityLink] | EntityLink] | None\n    The metadata of the lot. Optional. Metadata allowed values can be found using the Custom Fields API.\nhas_notes : bool\n    Whether the lot has notes. Read-only.\nhas_attachments : bool\n    Whether the lot has attachments. Read-only.\nbarcode_id : str\n    The barcode ID of the lot. Read-only.",
  "properties": {
    "status": {
      "anyOf": [
        {
          "$ref": "#/$defs/LotStatus"
        },
        {
          "type": "null"
        }
      ],
      "default": null
    },
    "Created": {
      "anyOf": [
        {
          "$ref": "#/$defs/AuditFields"
        },
        {
          "type": "null"
        }
      ],
      "default": null
    },
    "Updated": {
      "anyOf": [
        {
          "$ref": "#/$defs/AuditFields"
        },
        {
          "type": "null"
        }
      ],
      "default": null
    },
    "albertId": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Albertid"
    },
    "parentId": {
      "title": "Parentid",
      "type": "string"
    },
    "taskId": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Taskid"
    },
    "expirationDate": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Expirationdate"
    },
    "manufacturerLotNumber": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Manufacturerlotnumber"
    },
    "StorageLocation": {
      "anyOf": [
        {
          "$ref": "#/$defs/StorageLocation"
        },
        {
          "$ref": "#/$defs/EntityLink"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Storagelocation"
    },
    "packSize": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Packsize"
    },
    "initialQuantity": {
      "anyOf": [
        {
          "minimum": 0,
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Initialquantity"
    },
    "cost": {
      "anyOf": [
        {
          "minimum": 0,
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Cost"
    },
    "inventoryOnHand": {
      "title": "Inventoryonhand",
      "type": "number"
    },
    "Owner": {
      "anyOf": [
        {
          "items": {
            "anyOf": [
              {
                "$ref": "#/$defs/User"
              },
              {
                "$ref": "#/$defs/EntityLink"
              }
            ]
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Owner"
    },
    "lotNumber": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Lotnumber"
    },
    "externalBarcodeId": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Externalbarcodeid"
    },
    "Metadata": {
      "anyOf": [
        {
          "additionalProperties": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "integer"
              },
              {
                "type": "string"
              },
              {
                "$ref": "#/$defs/EntityLink"
              },
              {
                "items": {
                  "$ref": "#/$defs/EntityLink"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ]
          },
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Metadata"
    },
    "Location": {
      "anyOf": [
        {
          "$ref": "#/$defs/Location"
        },
        {
          "$ref": "#/$defs/EntityLink"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Location"
    },
    "notes": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Notes"
    },
    "hasNotes": {
      "anyOf": [
        {
          "type": "boolean"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Hasnotes"
    },
    "hasAttachments": {
      "anyOf": [
        {
          "type": "boolean"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Hasattachments"
    },
    "parentName": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Parentname"
    },
    "parentUnit": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Parentunit"
    },
    "parentCategory": {
      "anyOf": [
        {
          "$ref": "#/$defs/InventoryCategory"
        },
        {
          "type": "null"
        }
      ],
      "default": null
    },
    "barcodeId": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Barcodeid"
    }
  },
  "required": [
    "parentId",
    "inventoryOnHand"
  ],
  "title": "Lot",
  "type": "object"
}

Fields:

Validators:

id

id: LotId | None = None

inventory_id

inventory_id: InventoryId

task_id

task_id: str | None = None

expiration_date

expiration_date: str | None = None

manufacturer_lot_number

manufacturer_lot_number: str | None = None

storage_location

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

pack_size

pack_size: str | None = None

initial_quantity

initial_quantity: NonNegativeFloat | None = None

cost

cost: NonNegativeFloat | None = None

inventory_on_hand

inventory_on_hand: float

owner

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

lot_number

lot_number: str | None = None

external_barcode_id

external_barcode_id: str | None = None

metadata

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

status

status: LotStatus | None = None

location

location: SerializeAsEntityLink[Location] | None = None

notes

notes: str | None = None

has_notes

has_notes: bool | None = None

has_attachments

has_attachments: bool | None = None

parent_name

parent_name: str | None = None

parent_unit

parent_unit: str | None = None

parent_category

parent_category: InventoryCategory | None = None

barcode_id

barcode_id: str | None = None

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)