rattail.batch.labels

Handler for label batches

class rattail.batch.labels.LabelBatchHandler(*args, **kwargs)[source]

Handler for Print Labels batches.

auto_executable(batch)[source]

Must return a boolean indicating whether the given bath is eligible for “automatic” execution, i.e. immediately after batch is created.

batch_model_class

alias of LabelBatch

execute(batch, progress=None, **kwargs)[source]

Print some labels!

get_effective_rows(batch)[source]

Should return the set of rows from the given batch which are considered “effective” - i.e. when the batch is executed, these rows should be processed whereas the remainder should not.

Parameters:

batch – A VendorCatalogBatch instance.

Returns:

List of VendorCatalogBatchRow instances.

make_batch(session, progress=None, **kwargs)[source]

Make a new batch, with initial rows if applicable.

populate(batch, progress=None)[source]

Pre-fill batch with row data from handheld batch, etc.

populate_from_product_batch(batch, progress=None)[source]

Populate label batch from product batch.

print_labels(batch, rows, progress=None)[source]

Print all labels for the given batch.

quick_entry(session, batch, entry)[source]

Quick entry is assumed to be a UPC scan or similar user input. If a matching product can be found, this will add a new row for the batch; otherwise an error is raised.

read_products_from_file(batch, progress=None)[source]

Returns list of Product objects based on lookup from CSV file data.

# TODO: should this actually happen here? vs refresh and just mark product not found?

refresh_row(row)[source]

Inspect a row from the source data and populate additional attributes for it, according to what we find in the database.

set_options_from_file(batch)[source]

Set various batch options, if any are present within the data file.

setup_clone(batch, progress=None)

Perform any setup (caching etc.) necessary for cloning batch. Note that the oldbatch arg is the “old” batch, i.e. the one from which a clone is to be created.

setup_populate(batch, progress=None)

Perform any setup (caching etc.) necessary for populating a batch.

setup_refresh(batch, progress=None)

Perform any setup (caching etc.) necessary for refreshing a batch.