sideshow.db.model.orders

Data models for Orders

class sideshow.db.model.orders.Order(**kwargs)[source]

Represents an order for a customer. Each order has one or more items.

Usually, orders are created by way of a NewOrderBatch.

created

Timestamp when the order was created.

If the order is created via New Order Batch, this will match the batch execution timestamp.

created_by

Reference to the User who created the order.

customer_id

Proper account ID for the external customer to which the order pertains, if applicable.

See also local_customer and pending_customer.

customer_name

Name for the customer account.

email_address

Email address for the customer.

items

List of OrderItem records belonging to the order.

local_customer

Reference to the LocalCustomer record for the order, if applicable.

See also customer_id and pending_customer.

order_id

Unique ID for the order.

When the order is created from New Order Batch, this order ID will match the batch ID.

pending_customer

Reference to the PendingCustomer record for the order, if applicable.

See also customer_id and local_customer.

phone_number

Phone number for the customer.

store_id

ID of the store to which the order pertains, if applicable.

total_price

Full price (not including tax etc.) for all items on the order.

class sideshow.db.model.orders.OrderItem(**kwargs)[source]

Represents an order item within an Order.

Usually these are created from NewOrderBatchRow records.

case_price_quoted

Quoted price for a “case” of the item, if applicable.

This is mostly for display purposes; unit_price_quoted is used for calculations.

case_size

Case pack count for the product, if known.

department_id

ID of the department to which the product belongs, if known.

department_name

Name of the department to which the product belongs, if known.

discount_percent

Discount percent to apply when calculating total_price, if applicable.

local_product

Reference to the LocalProduct record for the order item, if applicable.

See also product_id and pending_product.

order

Reference to the Order to which the item belongs.

order_qty

Quantity (as decimal) of product being ordered.

This must be interpreted along with order_uom to determine the complete order quantity, e.g. “2 cases”.

order_uom

Code indicating the unit of measure for product being ordered.

This should be one of the codes from ORDER_UOM.

paid_amount

Amount which the customer has paid toward the total_price of the item.

payment_transaction_number

Transaction number in which payment for the order was taken, if applicable/known.

pending_product

Reference to the PendingProduct record for the order item, if applicable.

See also product_id and local_product.

product_brand

Brand name for the product - up to 100 chars.

product_description

Description for the product - up to 255 chars.

product_id

Proper ID for the external product which the order item represents, if applicable.

See also local_product and pending_product.

product_scancode

Scancode for the product, as string.

Note

This column allows 14 chars, so can store a full GPC with check digit. However as of writing the actual format used here does not matter to Sideshow logic; “anything” should work.

That may change eventually, depending on POS integration scenarios that come up. Maybe a config option to declare whether check digit should be included or not, etc.

product_size

Size of the product, as string - up to 30 chars.

product_weighed

Flag indicating the product is sold by weight; default is null.

sale_ends

End date/time for the sale in effect, if any.

This is only relevant if unit_price_sale is set.

sequence

1-based numeric sequence for the item, i.e. its line number within the order.

special_order

Flag indicating the item is a “special order” - e.g. something not normally carried by the store. Default is null.

status_code

Code indicating current status for the order item.

total_price

Full price (not including tax etc.) which the customer is quoted for the order item.

This is calculated using values from:

unit_cost

Cost of goods amount for one “unit” (not “case”) of the product, as decimal to 4 places.

unit_price_quoted

Quoted price for the item unit. This is the “effective” unit price, which is used to calculate total_price.

This price does not reflect the discount_percent. It normally should match either unit_price_reg or unit_price_sale.

unit_price_reg

Regular price for the item unit. Unless a sale is in effect, unit_price_quoted will typically match this value.

unit_price_sale

Sale price for the item unit, if applicable. If set, then unit_price_quoted will typically match this value. See also sale_ends.