Skip to content

lots.transfer() silently no-ops when quantity="ALL" and destination matches source location #674

Description

@karim-albert

When calling client.lots.transfer() with quantity="ALL" and a storage_location_id that matches the lot's current location, the SDK returns the unchanged lot with no error or warning. The Albert UI correctly rejects this with "Full Transfer is not allowed for same location", but the SDK gives no indication that nothing happened.

Steps to Reproduce

client.lots.transfer(
    lot_id="LOTA1",
    quantity="ALL",
    storage_location_id="<same location as source lot>",
)
# Returns the lot silently -- no error raised

Expected Behavior

A ValueError is raised with a message matching the UI's behavior:

ValueError: Full Transfer is not allowed for the same storage location. 
Provide a different destination storage_location_id.

Actual Behavior

The method returns the unmodified lot as if the operation succeeded.

Proposed Fix

In src/albert/collections/lots.py, inside the quantity == "ALL" branch of transfer(), add an explicit guard before the patch:

if current_location_id == storage_location_id:
    raise ValueError(
        "Full Transfer is not allowed for the same storage location. "
        "Provide a different destination storage_location_id."
    )

Test to Add

Replace the existing test_transfer_all_same_location_no_op test in tests/collections/test_lots.py with:

def test_transfer_all_same_location_raises(client: Albert, seeded_lot: Lot):
    current_location_id = seeded_lot.storage_location.id
    with pytest.raises(ValueError, match="Full Transfer is not allowed for the same storage location"):
        client.lots.transfer(
            lot_id=seeded_lot.id,
            quantity="ALL",
            storage_location_id=current_location_id,
        )

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions