Coverage for .tox/coverage/lib/python3.11/site-packages/sideshow/enum.py: 100%
103 statements
« prev ^ index » next coverage.py v7.16.1, created at 2026-09-22 12:21 -0500
« prev ^ index » next coverage.py v7.16.1, created at 2026-09-22 12:21 -0500
1# -*- coding: utf-8; -*-
2################################################################################
3#
4# Sideshow -- Case/Special Order Tracker
5# Copyright © 2024-2025 Lance Edgar
6#
7# This file is part of Sideshow.
8#
9# Sideshow is free software: you can redistribute it and/or modify it
10# under the terms of the GNU General Public License as published by
11# the Free Software Foundation, either version 3 of the License, or
12# (at your option) any later version.
13#
14# Sideshow is distributed in the hope that it will be useful, but
15# WITHOUT ANY WARRANTY; without even the implied warranty of
16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17# General Public License for more details.
18#
19# You should have received a copy of the GNU General Public License
20# along with Sideshow. If not, see <http://www.gnu.org/licenses/>.
21#
22################################################################################
23"""
24Enum Values
25"""
27from enum import Enum
28from collections import OrderedDict
30from wuttjamaican.enum import * # pylint: disable=wildcard-import,unused-wildcard-import
32ORDER_UOM_CASE = "CS"
33"""
34UOM code for ordering a "case" of product.
36Sideshow will treat "case" orders somewhat differently as compared to
37"unit" orders.
38"""
40ORDER_UOM_UNIT = "EA"
41"""
42UOM code for ordering a "unit" of product.
44This is the default "unit" UOM but in practice all others are treated
45the same by Sideshow, whereas "case" orders are treated somewhat
46differently.
47"""
49ORDER_UOM_KILOGRAM = "KG"
50"""
51UOM code for ordering a "kilogram" of product.
53This is treated same as "unit" by Sideshow. However it should
54(probably?) only be used for items where
55e.g. :attr:`~sideshow.db.model.orders.OrderItem.product_weighed` is
56true.
57"""
59ORDER_UOM_POUND = "LB"
60"""
61UOM code for ordering a "pound" of product.
63This is treated same as "unit" by Sideshow. However it should
64(probably?) only be used for items where
65e.g. :attr:`~sideshow.db.model.orders.OrderItem.product_weighed` is
66true.
67"""
69ORDER_UOM = OrderedDict(
70 [
71 (ORDER_UOM_CASE, "Cases"),
72 (ORDER_UOM_UNIT, "Units"),
73 (ORDER_UOM_KILOGRAM, "Kilograms"),
74 (ORDER_UOM_POUND, "Pounds"),
75 ]
76)
77"""
78Dict of possible code -> label options for ordering unit of measure.
80These codes are referenced by:
82* :attr:`sideshow.db.model.batch.neworder.NewOrderBatchRow.order_uom`
83* :attr:`sideshow.db.model.orders.OrderItem.order_uom`
84"""
87class PendingCustomerStatus(Enum):
88 """
89 Enum values for
90 :attr:`sideshow.db.model.customers.PendingCustomer.status`.
91 """
93 PENDING = "pending"
94 READY = "ready"
95 RESOLVED = "resolved"
96 IGNORED = "ignored"
99class PendingProductStatus(Enum):
100 """
101 Enum values for
102 :attr:`sideshow.db.model.products.PendingProduct.status`.
103 """
105 PENDING = "pending"
106 READY = "ready"
107 RESOLVED = "resolved"
108 IGNORED = "ignored"
111########################################
112# Order Item Status
113########################################
115ORDER_ITEM_STATUS_UNINITIATED = 1
116"""
117Indicates the item is "not yet initiated" - this probably is not
118useful but exists as a possibility just in case.
119"""
121ORDER_ITEM_STATUS_INITIATED = 10
122"""
123Indicates the item is "initiated" (aka. created) but not yet "ready"
124for buyer/PO. This may imply the price needs confirmation etc.
125"""
127ORDER_ITEM_STATUS_PAID_BEFORE = 50
128"""
129Indicates the customer has fully paid for the item, up-front before
130the buyer places PO etc. It implies the item is not yet "ready" for
131some reason.
132"""
134# TODO: deprecate / remove this one
135ORDER_ITEM_STATUS_PAID = ORDER_ITEM_STATUS_PAID_BEFORE
137ORDER_ITEM_STATUS_READY = 100
138"""
139Indicates the item is "ready" for buyer to include it on a vendor
140purchase order.
141"""
143ORDER_ITEM_STATUS_PLACED = 200
144"""
145Indicates the buyer has placed a vendor purchase order which includes
146this item. The item is thereby "on order" until the truck arrives.
147"""
149ORDER_ITEM_STATUS_RECEIVED = 300
150"""
151Indicates the item has been received as part of a vendor delivery.
152The item is thereby "on hand" until customer comes in for pickup.
153"""
155ORDER_ITEM_STATUS_CONTACTED = 350
156"""
157Indicates the customer has been notified that the item is "on hand"
158and awaiting their pickup.
159"""
161ORDER_ITEM_STATUS_CONTACT_FAILED = 375
162"""
163Indicates the attempt(s) to notify customer have failed. The item is
164on hand but the customer does not know to pickup.
165"""
167ORDER_ITEM_STATUS_DELIVERED = 500
168"""
169Indicates the customer has picked up the item.
170"""
172ORDER_ITEM_STATUS_PAID_AFTER = 550
173"""
174Indicates the customer has fully paid for the item, as part of their
175pickup. This completes the cycle for orders which require payment on
176the tail end.
177"""
179ORDER_ITEM_STATUS_CANCELED = 900
180"""
181Indicates the order item has been canceled.
182"""
184ORDER_ITEM_STATUS_REFUND_PENDING = 910
185"""
186Indicates the order item has been canceled, and the customer is due a
187(pending) refund.
188"""
190ORDER_ITEM_STATUS_REFUNDED = 920
191"""
192Indicates the order item has been canceled, and the customer has been
193given a refund.
194"""
196ORDER_ITEM_STATUS_RESTOCKED = 930
197"""
198Indicates the product has been restocked, e.g. after the order item
199was canceled.
200"""
202ORDER_ITEM_STATUS_EXPIRED = 940
203"""
204Indicates the order item and/or product has expired.
205"""
207ORDER_ITEM_STATUS_INACTIVE = 950
208"""
209Indicates the order item has become inactive.
210"""
212ORDER_ITEM_STATUS = OrderedDict(
213 [
214 (ORDER_ITEM_STATUS_UNINITIATED, "uninitiated"),
215 (ORDER_ITEM_STATUS_INITIATED, "initiated"),
216 (ORDER_ITEM_STATUS_PAID_BEFORE, "paid"),
217 (ORDER_ITEM_STATUS_READY, "ready"),
218 (ORDER_ITEM_STATUS_PLACED, "placed"),
219 (ORDER_ITEM_STATUS_RECEIVED, "received"),
220 (ORDER_ITEM_STATUS_CONTACTED, "contacted"),
221 (ORDER_ITEM_STATUS_CONTACT_FAILED, "contact failed"),
222 (ORDER_ITEM_STATUS_DELIVERED, "delivered"),
223 (ORDER_ITEM_STATUS_PAID_AFTER, "paid"),
224 (ORDER_ITEM_STATUS_CANCELED, "canceled"),
225 (ORDER_ITEM_STATUS_REFUND_PENDING, "refund pending"),
226 (ORDER_ITEM_STATUS_REFUNDED, "refunded"),
227 (ORDER_ITEM_STATUS_RESTOCKED, "restocked"),
228 (ORDER_ITEM_STATUS_EXPIRED, "expired"),
229 (ORDER_ITEM_STATUS_INACTIVE, "inactive"),
230 ]
231)
232"""
233Dict of possible code -> label options for :term:`order item` status.
235These codes are referenced by:
237* :attr:`sideshow.db.model.orders.OrderItem.status_code`
238"""
241########################################
242# Order Item Event Type
243########################################
245ORDER_ITEM_EVENT_INITIATED = 10
246"""
247Indicates the item was "initiated" - this occurs when the
248:term:`order` is first created.
249"""
251ORDER_ITEM_EVENT_PRICE_CONFIRMED = 20
252"""
253Indicates the item's price was confirmed by a user who is authorized
254to do that.
255"""
257ORDER_ITEM_EVENT_PAYMENT_RECEIVED = 50
258"""
259Indicates payment was received for the item. This may occur toward
260the beginning, or toward the end, of the item's life cycle depending
261on app configuration etc.
262"""
264# TODO: deprecate / remove this
265ORDER_ITEM_EVENT_PAID = ORDER_ITEM_EVENT_PAYMENT_RECEIVED
267ORDER_ITEM_EVENT_READY = 100
268"""
269Indicates the item has become "ready" for buyer placement on a new
270vendor purchase order. Often this will occur when the :term:`order`
271is first created, if the data is suitable. However this may be
272delayed if e.g. the price needs confirmation.
273"""
275ORDER_ITEM_EVENT_CUSTOMER_RESOLVED = 120
276"""
277Indicates the customer for the :term:`order` has been assigned to a
278"proper" (existing) account. This may happen (after the fact) if the
279order was first created with a new/unknown customer.
280"""
282ORDER_ITEM_EVENT_PRODUCT_RESOLVED = 140
283"""
284Indicates the product for the :term:`order item` has been assigned to
285a "proper" (existing) product record. This may happen (after the
286fact) if the order was first created with a new/unknown product.
287"""
289ORDER_ITEM_EVENT_PLACED = 200
290"""
291Indicates the buyer has placed a vendor purchase order which includes
292this item. So the item is "on order" until the truck arrives.
293"""
295ORDER_ITEM_EVENT_REORDER = 210
296"""
297Indicates the item was not received with the delivery on which it was
298expected, and must be re-ordered from vendor.
299"""
301ORDER_ITEM_EVENT_RECEIVED = 300
302"""
303Indicates the receiver has found the item while receiving a vendor
304delivery. The item is set aside and is "on hand" until customer comes
305in to pick it up.
306"""
308ORDER_ITEM_EVENT_CONTACTED = 350
309"""
310Indicates the customer has been contacted, to notify them of the item
311being on hand and ready for pickup.
312"""
314ORDER_ITEM_EVENT_CONTACT_FAILED = 375
315"""
316Indicates an attempt was made to contact the customer, to notify them
317of item being on hand, but the attempt failed, e.g. due to bad phone
318or email on file.
319"""
321ORDER_ITEM_EVENT_DELIVERED = 500
322"""
323Indicates the customer has picked up the item.
324"""
326ORDER_ITEM_EVENT_STATUS_CHANGE = 700
327"""
328Indicates a manual status change was made. Such an event should
329ideally contain a note with further explanation.
330"""
332ORDER_ITEM_EVENT_NOTE_ADDED = 750
333"""
334Indicates an arbitrary note was added.
335"""
337ORDER_ITEM_EVENT_CANCELED = 900
338"""
339Indicates the :term:`order item` was canceled.
340"""
342ORDER_ITEM_EVENT_REFUND_PENDING = 910
343"""
344Indicates the customer is due a (pending) refund for the item.
345"""
347ORDER_ITEM_EVENT_REFUNDED = 920
348"""
349Indicates the customer has been refunded for the item.
350"""
352ORDER_ITEM_EVENT_RESTOCKED = 930
353"""
354Indicates the product has been restocked, e.g. due to the order item
355being canceled.
356"""
358ORDER_ITEM_EVENT_EXPIRED = 940
359"""
360Indicates the order item (or its product) has expired.
361"""
363ORDER_ITEM_EVENT_INACTIVE = 950
364"""
365Indicates the order item has become inactive.
366"""
368ORDER_ITEM_EVENT_OTHER = 999
369"""
370Arbitrary event type which does not signify anything in particular.
371If used, the event should be given an explanatory note.
372"""
374ORDER_ITEM_EVENT = OrderedDict(
375 [
376 (ORDER_ITEM_EVENT_INITIATED, "initiated"),
377 (ORDER_ITEM_EVENT_PRICE_CONFIRMED, "price confirmed"),
378 (ORDER_ITEM_EVENT_PAYMENT_RECEIVED, "payment received"),
379 (ORDER_ITEM_EVENT_READY, "ready to proceed"),
380 (ORDER_ITEM_EVENT_CUSTOMER_RESOLVED, "customer resolved"),
381 (ORDER_ITEM_EVENT_PRODUCT_RESOLVED, "product resolved"),
382 (ORDER_ITEM_EVENT_PLACED, "placed with vendor"),
383 (ORDER_ITEM_EVENT_REORDER, "marked for re-order"),
384 (ORDER_ITEM_EVENT_RECEIVED, "received from vendor"),
385 (ORDER_ITEM_EVENT_CONTACTED, "customer contacted"),
386 (ORDER_ITEM_EVENT_CONTACT_FAILED, "contact failed"),
387 (ORDER_ITEM_EVENT_DELIVERED, "delivered"),
388 (ORDER_ITEM_EVENT_STATUS_CHANGE, "changed status"),
389 (ORDER_ITEM_EVENT_NOTE_ADDED, "added note"),
390 (ORDER_ITEM_EVENT_CANCELED, "canceled"),
391 (ORDER_ITEM_EVENT_REFUND_PENDING, "refund pending"),
392 (ORDER_ITEM_EVENT_REFUNDED, "refunded"),
393 (ORDER_ITEM_EVENT_RESTOCKED, "restocked"),
394 (ORDER_ITEM_EVENT_EXPIRED, "expired"),
395 (ORDER_ITEM_EVENT_INACTIVE, "inactive"),
396 (ORDER_ITEM_EVENT_OTHER, "other"),
397 ]
398)
399"""
400Dict of possible code -> label options for :term:`order item` event
401types.
403These codes are referenced by:
405* :attr:`sideshow.db.model.orders.OrderItemEvent.type_code`
406"""