rattail.db.model.purchase

Data model for purchase orders

class rattail.db.model.purchase.Purchase(**kwargs)[source]

Represents a purchase made by a store.

batches

List of batches associated with the purchase.

buyer

Reference to the Employee who placed the order with the vendor, if applicable/known.

buyer_uuid
created

Timestamp when the purchase was first created within this system.

created_by

Reference to the User who first created the purchase within this system.

credits

List of PurchaseCredit instances for the purchase.

date_ordered

Date on which the purchase order was first submitted to the vendor.

date_received

Date on which the order was received at the store.

date_shipped

Date on which the order was shipped from the vendor.

department

Reference to the primary Department for which the purchase was made.

department_uuid
id

Numeric ID for the purchase. This is auto-increment from the general Batch ID sequence.

invoice_date

Invoice date, if applicable.

invoice_number

Invoice number, e.g. for cross-reference with another system.

invoice_total

Total cost according to the invoice.

items

List of PurchaseItem instances for the purchase.

notes_to_vendor

Any arbitrary notes to the vendor, regarding the purchase.

po_number

Purchase order number, e.g. for cross-reference with another system.

po_total

Total cost according to the initial purchase order.

ship_method

Code representing the shipping method.

status

Numeric code used to signify current status for the purchase, e.g. placed or paid etc.

store

Reference to the Store for which the purchase was made.

store_uuid
vendor

Reference to the Vendor to which the purchase was made.

vendor_uuid
class rattail.db.model.purchase.PurchaseBase[source]

Base class for purchases; defines common fields.

class rattail.db.model.purchase.PurchaseCredit(**kwargs)[source]

Represents a purchase credit item.

brand_name

Brand name for the credit item.

case_quantity

Number of units in a single case of product.

cases_shorted

Number of cases of product which were ordered but not received.

credit_total

Actual total cost for credit, i.e. value of missing/damaged product.

credit_type

Type of the credit, i.e. damaged/expired/mispick/missing

date_ordered

Date on which the purchase order was first submitted to the vendor.

date_received

Date on which the order was received at the store.

date_shipped

Date on which the order was shipped from the vendor.

department_name

Name of the department to which the product belongs.

department_number

Number of the department to which the product belongs.

description

Product description for the credit item.

expiration_date

Expiration date marked on expired product, if applicable.

invoice_case_cost

Actual cost per case of product, per invoice.

invoice_date

Invoice date, if applicable.

invoice_line_number

Line number from the invoice if known, for cross-reference.

invoice_number

Invoice number, e.g. for cross-reference with another system.

invoice_total

Actual total cost for line item, per invoice.

invoice_unit_cost

Actual cost per single unit of product, per invoice.

item

Reference to the purchase item with which the credit is associated.

mispick_brand_name

Brand name for the mispick item.

mispick_description

Product description for the mispick item.

mispick_product

Reference to the Product which was shipped in place of the one which was ordered.

mispick_product_uuid
mispick_size

Product size for the mispick item.

mispick_upc

Product UPC for the mispick item.

product

Reference to the Product with which the credit is associated.

product_discarded

Indicates the associated product was discarded, and cannot be returned to vendor.

product_uuid
purchase

Reference to the Purchase to which the credit applies.

size

Product size for the credit item.

status

Numeric code used to signify current status for the credit.

store

Reference to the Store for which the purchase was made.

store_uuid
units_shorted

Number of cases of product which were ordered but not received.

upc

Product UPC for the credit item.

vendor

Reference to the Vendor to which the purchase was made.

vendor_item_code

Vendor-specific code for the credit item.

vendor_uuid
class rattail.db.model.purchase.PurchaseCreditBase[source]

Base class for purchase credits.

class rattail.db.model.purchase.PurchaseItem(**kwargs)[source]

Represents a line item on a purchase.

brand_name

Brand name for the line item.

case_quantity

Number of units in a single case of product.

cases_damaged

Number of cases of product which were shipped damaged.

cases_expired

Number of cases of product which were shipped expired.

cases_mispick

Number of cases of product for which mispick was shipped.

cases_missing

Number of cases of product which were ultimately missing.

cases_ordered

Number of cases of product which were initially ordered.

cases_received

Number of cases of product which were ultimately received.

cases_shipped

Number of cases of product which were supposedly shipped by/from the vendor.

catalog_unit_cost

This corresponds to the ProductCost.unit_cost (aka. “catalog” or wholesale cost) amount for the product/vendor, if applicable.

department_name

Name of the department to which the product belongs.

department_number

Number of the department to which the product belongs.

description

Product description for the line item.

invoice_case_cost

Actual cost per case of product, per invoice.

invoice_case_size

Number of units in a single case of product, according to invoice.

invoice_date

Invoice date, if applicable.

invoice_line_number

Line number from the invoice if known, for cross-reference.

invoice_number

Invoice number, e.g. for cross-reference with another system.

invoice_total

Total cost for the line item, according to the invoice.

invoice_unit_cost

Actual cost per single unit of product, per invoice.

item_id

Generic ID string for the item.

out_of_stock

Flag indicating whether the item was known to be “out of stock” per the vendor invoice.

po_case_size

Number of units in a single case of product, according to PO.

po_line_number

Line number from the PO if known, for cross-reference.

po_total

Total cost for the line item, according to the initial purchase order.

po_unit_cost

Expected cost per single unit of product, as of initial order placement.

product

Reference to the Product which the line item contains / represents.

product_uuid
purchase

Reference to the Purchase to which the item belongs.

sequence

Effectively the (internal) line number for the purchase line item, using 1-based indexing.

size

Product size for the line item.

status

Numeric code used to signify current status for the line item, e.g. for highlighting rows when invoice cost differed from expected/PO cost (?)

units_damaged

Number of units of product which were shipped damaged.

units_expired

Number of units of product which were shipped expired.

units_mispick

Number of units of product for which mispick was shipped.

units_missing

Number of units of product which were ultimately missing.

units_ordered

Number of units of product which were initially ordered.

units_received

Number of units of product which were ultimately received.

units_shipped

Number of units of product which were supposedly shipped by/from the vendor.

upc

Product UPC for the line item.

vendor_code

Vendor item code for the product.

class rattail.db.model.purchase.PurchaseItemBase[source]

Base class for purchase line items.