rattail.db.batch.vendorcatalog

Models for vendor catalog batches

class rattail.db.batch.vendorcatalog.model.VendorCatalog(**kwargs)[source]

Vendor catalog, the source data file of which has been provided by a user, and may be further processed in some site-specific way.

cognized

Date and time when the batch data was last cognized.

cognized_by

Reference to the User who last cognized the batch data.

created

Date and time when the batch was first created.

created_by

Reference to the User who first created the batch.

data_rows

Collection of data rows for the batch.

Note

I would prefer for this attribute to simply be named “rows” instead of “data_rows”, but unfortunately (as of this writing) “rows” is essentially a reserved word in FormAlchemy.

effective

General effective date for the catalog, as determined by the data file. Note that not all catalog files will include this; also, some catalogs include effective dates on a per-product basis.

executed

Date and time when the batch was (last) executed.

executed_by

Reference to the User who (last) executed the batch.

filename

Base name of the file which was used as the data source.

parser_key

The key of the parser used to parse the contents of the data file.

purge

Date after which the batch may be purged.

rowcount

Cached row count for the batch. No guarantees perhaps, but should be accurate.

vendor

Reference to the Vendor to which the catalog pertains.

class rattail.db.batch.vendorcatalog.model.VendorCatalogRow(**kwargs)[source]

Row of data within a vendor catalog.

batch

Reference to the parent batch to which the row belongs.

brand_name

Brand name of the product.

case_cost

Cost per case of the product.

case_cost_diff

Case cost difference between the catalog and product’s original cost record.

case_size

Number of units in a case of product.

description

Description of the product.

old_case_cost

Original case cost for the product, if any.

old_case_size

Original case size for the product, if any.

old_unit_cost

Original unit cost for the product, if any.

old_vendor_code

Original vendor code for the product, if any.

product

Reference to the Product with which the row is associated, if any.

removed

Flag to indicate a row has been removed from the batch.

sequence

Sequence number of the row within the batch. This number should be from 1 to the actual number of rows in the batch.

size

Size of the product, as string.

status_code

Status code for the data row. This indicates whether the row’s product could be found in the system, etc. Ultimately the meaning of this is defined by each particular batch type.

status_text

Short description of row status. Ultimately the meaning and use of this is defined by each particular batch type.

unit_cost

Cost per unit of the product.

unit_cost_diff

Unit cost difference between the catalog and product’s original cost record.

upc

UPC for the row.

vendor_code

Vendor’s unique code for the product. The meaning of this corresponds to that of the ProductCost.code column.

Handler for Vendor Catalog batches

class rattail.db.batch.vendorcatalog.handler.VendorCatalogHandler(config)[source]

Handler for vendor catalog batches.

batch_model_class

alias of VendorCatalog

cognize_row(session, row)[source]

Inspect a single row from a catalog, and set its attributes based on whether or not the product exists, if we already have a cost record for the vendor, if the catalog contains a change etc. Note that the product lookup is done first by UPC and then by vendor item code.

cost_differs(row, cost)[source]

Compare a batch row with a cost record to determine whether they match or differ.

refresh_data(session, batch, progress=None)[source]

Refresh all data for the batch.