rattail.batch.handheld

Handheld batch handler

class rattail.batch.handheld.HandheldBatchHandler(config, **kwargs)[source]

Handler for handheld batches.

batch_model_class

alias of HandheldBatch

describe_execution(batch, **kwargs)[source]

This method should essentially return some text describing briefly what will happen when the given batch is executed.

Parameters:

batch – The batch in question, which is a candidate for execution.

Returns:

String value describing the batch execution.

execute(batch, user=None, action='make_inventory_batch', progress=None, **kwargs)[source]

Execute the given batch, according to the given kwargs. This is really where the magic happens, although each handler must define that magic, since the default logic does nothing at all.

Note that callers should not use this method, but custom batch handlers should override this method. Conversely, custom handlers should not override the do_execute() method, but callers should use that one directly.

execute_many(batches, user=None, action='make_inventory_batch', progress=None, **kwargs)[source]

Execute a set of batches, with given progress and kwargs. Default behavior is to simply execute each batch in succession. Any batches which are already executed are skipped.

Handlers may have to override this method if “grouping” or other special behavior is needed.

make_inventory_batch(handheld_batches, user, progress=None, **kwargs)[source]

Make a new Inventory Batch from the given Handheld Batch(es).

Parameters:
  • handheld_batches – Sequence of one or more HandheldBatch instances from which a new inventory batch should be made.

  • userUser who is responsible for this action.

Returns:

A new InventoryBatch instance, populated from the given handheld batch(es).

make_label_batch(handheld_batches, user, progress=None, **kwargs)[source]

Make a new Label Batch from the given Handheld Batch(es).

Parameters:
  • handheld_batches – Sequence of one or more HandheldBatch instances from which a new label batch should be made.

  • userUser who is responsible for this action.

Returns:

A new LabelBatch instance, populated from the given handheld batch(es).

parse_input_file_motorola(path, progress=None)[source]

Parse a RattailCE (binary or CSV) file to generate initial rows.

parse_input_file_palmos(path, progress=None)[source]

Parse a Rattail PalmOS (CSV) file to generate initial rows.

populate(batch, progress=None)[source]

Pre-fill batch with row data from an input data file, parsed according to the batch device type.

refresh_batch_status(batch)[source]

Update the batch status, as needed. This method does nothing by default, but may be overridden if the overall batch status needs to be updated according to the status of its rows. This method may be invoked whenever rows are added, removed, updated etc.

refresh_row(row)[source]

This method will be passed a row object which has already been properly added to a batch, and which has basic required fields already populated. This method is then responsible for further populating all applicable fields for the row, based on current data within the relevant system(s).

Note that in some cases this method may be called multiple times for the same row, e.g. once when first creating the batch and then later when a user explicitly refreshes the batch. The method logic must account for this possibility.

should_populate(batch)[source]

Must return a boolean indicating whether the given batch should be populated from an initial data source, i.e. at time of batch creation. Override this method if you need to inspect the batch in order to determine whether the populate step is needed. Default behavior is to simply return the value of populate_batches.