rattail.db.model.batch.pricing

Data model for pricing batches

class rattail.db.model.batch.pricing.PricingBatch(**kwargs)[source]

Primary data model for pricing batches.

calculate_for_manual

Flag indicating whether prices should be calculated for products which are manually priced under normal circumstances.

cognized

Date and time when the batch data was last cognized.

cognized_by

Reference to the User who last cognized the batch data.

cognized_by_uuid
complete

Flag to indicate whether the batch is complete. This may be used to assist with workflow when entering/executing new batches.

created

Date and time when the batch was first created.

created_by

Reference to the User who first created the batch.

created_by_uuid
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.

description

Basic (loosely identifying) description for the batch.

executed

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

executed_by

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

executed_by_uuid
extra_data

Extra field for arbitrary data, useful to the batch handler etc. Note that there is no structure assumed here, it can be JSON or whatever is needed.

id

Numeric ID for the batch, unique across all “new-style” batches within the Rattail database.

input_filename

Base name of the input data file, if applicable.

min_diff_percent

Percentage to which the new price margin change is to be compared, to determine whether the price change is “minor”.

min_diff_threshold

Threshold amount in currency units (i.e. dollars), to which the new price change is compared, to determine whether the price change is “minor”.

notes

Any arbitrary notes for the batch.

params

Extra parameters for the batch, encoded as JSON. This hopefully can be useful for “many” batches, to avoid needing to add extra flags to the schema etc.

purge

Date after which the batch may be purged.

row_class

alias of PricingBatchRow

rowcount

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

shelved

Flag to indicate whether the batch is “shelved” for later processing. This may be used to assist with workflow when entering/executing new batches.

start_date

Start date for prices within the batch.

status_code

Status code for the batch as a whole. This indicates whether the batch is “okay” and ready to execute, or (why) not etc.

status_text

Text which may briefly explain the batch status code, if needed.

uuid
class rattail.db.model.batch.pricing.PricingBatchRow(**kwargs)[source]

Row of data within a pricing batch.

alternate_code

Alternate code (UPC, PLU etc.) for the item.

batch

Reference to the parent batch to which the row belongs.

batch_uuid
brand_name

Brand name of the product.

current_price

The “current” price for the item (i.e. which overrides the “regular” price), if there is one at time of batch creation/refresh.

current_price_ends

End date/time for the current_price, if applicable.

current_price_starts

Start date/time for the current_price, if applicable.

current_price_type

The “type” code for current_price, if applicable. Distinguishes e.g. Sale price from TPR.

department_name

Name of the department to which the product belongs.

department_number

Number of the department to which the product belongs.

description

Description of the product.

discounted_unit_cost

The “discounted” base unit cost for the item. This is meant to be the “effective” unit cost which is used as the basis for the price calculation.

family_code

Family code for the item.

item_entry

Raw entry value, as obtained from the initial data source, and which is used to locate the product within the system. This raw value is preserved in case the initial lookup fails and a refresh must attempt further lookup(s) later. Only used by certain batch handlers in practice.

item_id

Generic ID string for the product associated with the row.

manually_priced

Optional flag to indicate whether the product is manually priced, under normal circumstances.

margin_diff

Difference in margin, between the new and old price margins.

modified

Last modification time of the row. This should be automatically set when the row is first created, as well as anytime it’s updated thereafter.

new_price

The “new” price for the item, as calculated by the batch handler logic.

old_price

The “old” price for the item. This is assumed to be the “regular” price as of batch creation.

old_price_margin

Profit margin for the “old” price vs. the “effective” unit cost (discounted_unit_cost).

old_true_margin

Profit margin for the “old” price vs. the “true” unit cost (true_unit_cost).

price_diff

Difference in dollars, between the new and old price amounts.

price_diff_percent

Difference in percentage, between the new and old price amounts.

price_margin

Profit margin for the “new” price vs. the “effective” unit cost (discounted_unit_cost).

price_markup

Markup used to calculate new price, if applicable.

product

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

product_uuid
regular_unit_cost

The “normal” base unit cost for the item, i.e. with no discounts applied.

removed

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

report_code

Report code for the item.

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.

subdepartment_name

Name of the subdepartment to which the product belongs.

subdepartment_number

Number of the subdepartment to which the product belongs.

suggested_price

The “suggested” retail price for the item. This is assumed to be defined by some external source, i.e. traditional MSRP as opposed to the price being actually suggested by the batch logic.

true_margin

Profit margin for the “new” price vs. the “true” unit cost (true_unit_cost).

true_unit_cost

The “true” base unit cost for the item. Note that this may vary over time based on allowances etc.

upc

UPC for the product associated with the row.

uuid
vendor_item_code

Vendor-specific code (SKU) for the item.