sideshow.orders¶
Sideshow Order Handler
- class sideshow.orders.OrderHandler(config)[source]¶
Base class and default implementation for the order handler.
This is responsible for business logic involving customer orders after they have been first created. (The new order batch handler is responsible for creation logic.)
- expose_store_id()[source]¶
Returns boolean indicating whether the
store_idfield should be exposed at all. This is false by default.
- get_order_qty_uom_text(order_qty, order_uom, case_size=None, html=False)[source]¶
Return the display text for a given order quantity.
Default logic will return something like
"3 Cases (x 6 = 18 Units)".- Parameters:
order_qty – Numeric quantity.
order_uom – An order UOM constant; should be something from
ORDER_UOM.case_size – Case size for the product, if known.
html – Whether the return value should include any HTML. If false (the default), it will be plain text only. If true, will replace the
xcharacter with×.
- Returns:
Display text.
- item_status_to_variant(status_code)[source]¶
Return a Buefy style variant for the given status code.
Default logic will return
Nonefor “normal” item status, but may return'warning'for some (e.g. canceled).- Parameters:
status_code – The status code for an order item.
- Returns:
Style variant string (e.g.
'warning') orNone.
- process_contact_failure(items, user, note=None)[source]¶
Process the “failed contact” step for the given order items.
This will update the status for each item, to indicate “contact failed”.
- process_contact_success(items, user, note=None)[source]¶
Process the “successful contact” step for the given order items.
This will update the status for each item, to indicate they are “contacted” and awaiting delivery.
- process_delivery(items, user, note=None)[source]¶
Process the “delivery” step for the given order items.
This will update the status for each item, to indicate they are “delivered”.
- process_placement(items, user, vendor_name=None, po_number=None, note=None)[source]¶
Process the “placement” step for the given order items.
This may eventually do something involving an actual purchase order, or at least a minimal representation of one, but for now it does not.
Instead, this will simply update each item to indicate its new status. A note will be attached to indicate the vendor and/or PO number, if provided.
- process_receiving(items, user, vendor_name=None, invoice_number=None, po_number=None, note=None)[source]¶
Process the “receiving” step for the given order items.
This will update the status for each item, to indicate they are “received”.
TODO: This also should email the customer notifying their items are ready for pickup etc.
- process_reorder(items, user, note=None)[source]¶
Process the “reorder” step for the given order items.
This will update the status for each item, to indicate they are “ready” (again) for placement.
- process_restock(items, user, note=None)[source]¶
Process the “restock” step for the given order items.
This will update the status for each item, to indicate they are “restocked”.
- resolve_pending_product(pending_product, product_info, user, note=None)[source]¶
Resolve a pending product, to reflect the given product info.
At a high level this does 2 things:
update the
pending_productfind and update any related order item(s)
The first step just sets
product_idfrom the provided info, and gives it the “resolved” status. Note that it does not update the pending product record further, so it will not fully “match” the product info.The second step will fetch all
OrderItemrecords which reference thepending_productand which do not yet have aproduct_idvalue. For each, it then updates the order item to contain all data fromproduct_info. And finally, it adds an event to the item history, indicating who resolved and when. (Ifnoteis specified, a second event is added for that.)- Parameters:
pending_product –
PendingProductto be resolved.product_info – Dict of product info, as obtained from
get_product_info_external().user –
Userwho is performing the action.note – Optional note to be added to event history for related order item(s).