Coverage for .tox/coverage/lib/python3.11/site-packages/sideshow/enum.py: 100%
103 statements
« prev ^ index » next coverage.py v7.9.1, created at 2025-06-16 07:16 -0500
« prev ^ index » next coverage.py v7.9.1, created at 2025-06-16 07:16 -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 *
33ORDER_UOM_CASE = 'CS'
34"""
35UOM code for ordering a "case" of product.
37Sideshow will treat "case" orders somewhat differently as compared to
38"unit" orders.
39"""
41ORDER_UOM_UNIT = 'EA'
42"""
43UOM code for ordering a "unit" of product.
45This is the default "unit" UOM but in practice all others are treated
46the same by Sideshow, whereas "case" orders are treated somewhat
47differently.
48"""
50ORDER_UOM_KILOGRAM = 'KG'
51"""
52UOM code for ordering a "kilogram" of product.
54This is treated same as "unit" by Sideshow. However it should
55(probably?) only be used for items where
56e.g. :attr:`~sideshow.db.model.orders.OrderItem.product_weighed` is
57true.
58"""
60ORDER_UOM_POUND = 'LB'
61"""
62UOM code for ordering a "pound" of product.
64This is treated same as "unit" by Sideshow. However it should
65(probably?) only be used for items where
66e.g. :attr:`~sideshow.db.model.orders.OrderItem.product_weighed` is
67true.
68"""
70ORDER_UOM = OrderedDict([
71 (ORDER_UOM_CASE, "Cases"),
72 (ORDER_UOM_UNIT, "Units"),
73 (ORDER_UOM_KILOGRAM, "Kilograms"),
74 (ORDER_UOM_POUND, "Pounds"),
75])
76"""
77Dict of possible code -> label options for ordering unit of measure.
79These codes are referenced by:
81* :attr:`sideshow.db.model.batch.neworder.NewOrderBatchRow.order_uom`
82* :attr:`sideshow.db.model.orders.OrderItem.order_uom`
83"""
86class PendingCustomerStatus(Enum):
87 """
88 Enum values for
89 :attr:`sideshow.db.model.customers.PendingCustomer.status`.
90 """
91 PENDING = 'pending'
92 READY = 'ready'
93 RESOLVED = 'resolved'
94 IGNORED = 'ignored'
97class PendingProductStatus(Enum):
98 """
99 Enum values for
100 :attr:`sideshow.db.model.products.PendingProduct.status`.
101 """
102 PENDING = 'pending'
103 READY = 'ready'
104 RESOLVED = 'resolved'
105 IGNORED = 'ignored'
108########################################
109# Order Item Status
110########################################
112ORDER_ITEM_STATUS_UNINITIATED = 1
113"""
114Indicates the item is "not yet initiated" - this probably is not
115useful but exists as a possibility just in case.
116"""
118ORDER_ITEM_STATUS_INITIATED = 10
119"""
120Indicates the item is "initiated" (aka. created) but not yet "ready"
121for buyer/PO. This may imply the price needs confirmation etc.
122"""
124ORDER_ITEM_STATUS_PAID_BEFORE = 50
125"""
126Indicates the customer has fully paid for the item, up-front before
127the buyer places PO etc. It implies the item is not yet "ready" for
128some reason.
129"""
131# TODO: deprecate / remove this one
132ORDER_ITEM_STATUS_PAID = ORDER_ITEM_STATUS_PAID_BEFORE
134ORDER_ITEM_STATUS_READY = 100
135"""
136Indicates the item is "ready" for buyer to include it on a vendor
137purchase order.
138"""
140ORDER_ITEM_STATUS_PLACED = 200
141"""
142Indicates the buyer has placed a vendor purchase order which includes
143this item. The item is thereby "on order" until the truck arrives.
144"""
146ORDER_ITEM_STATUS_RECEIVED = 300
147"""
148Indicates the item has been received as part of a vendor delivery.
149The item is thereby "on hand" until customer comes in for pickup.
150"""
152ORDER_ITEM_STATUS_CONTACTED = 350
153"""
154Indicates the customer has been notified that the item is "on hand"
155and awaiting their pickup.
156"""
158ORDER_ITEM_STATUS_CONTACT_FAILED = 375
159"""
160Indicates the attempt(s) to notify customer have failed. The item is
161on hand but the customer does not know to pickup.
162"""
164ORDER_ITEM_STATUS_DELIVERED = 500
165"""
166Indicates the customer has picked up the item.
167"""
169ORDER_ITEM_STATUS_PAID_AFTER = 550
170"""
171Indicates the customer has fully paid for the item, as part of their
172pickup. This completes the cycle for orders which require payment on
173the tail end.
174"""
176ORDER_ITEM_STATUS_CANCELED = 900
177"""
178Indicates the order item has been canceled.
179"""
181ORDER_ITEM_STATUS_REFUND_PENDING = 910
182"""
183Indicates the order item has been canceled, and the customer is due a
184(pending) refund.
185"""
187ORDER_ITEM_STATUS_REFUNDED = 920
188"""
189Indicates the order item has been canceled, and the customer has been
190given a refund.
191"""
193ORDER_ITEM_STATUS_RESTOCKED = 930
194"""
195Indicates the product has been restocked, e.g. after the order item
196was canceled.
197"""
199ORDER_ITEM_STATUS_EXPIRED = 940
200"""
201Indicates the order item and/or product has expired.
202"""
204ORDER_ITEM_STATUS_INACTIVE = 950
205"""
206Indicates the order item has become inactive.
207"""
209ORDER_ITEM_STATUS = OrderedDict([
210 (ORDER_ITEM_STATUS_UNINITIATED, "uninitiated"),
211 (ORDER_ITEM_STATUS_INITIATED, "initiated"),
212 (ORDER_ITEM_STATUS_PAID_BEFORE, "paid"),
213 (ORDER_ITEM_STATUS_READY, "ready"),
214 (ORDER_ITEM_STATUS_PLACED, "placed"),
215 (ORDER_ITEM_STATUS_RECEIVED, "received"),
216 (ORDER_ITEM_STATUS_CONTACTED, "contacted"),
217 (ORDER_ITEM_STATUS_CONTACT_FAILED, "contact failed"),
218 (ORDER_ITEM_STATUS_DELIVERED, "delivered"),
219 (ORDER_ITEM_STATUS_PAID_AFTER, "paid"),
220 (ORDER_ITEM_STATUS_CANCELED, "canceled"),
221 (ORDER_ITEM_STATUS_REFUND_PENDING, "refund pending"),
222 (ORDER_ITEM_STATUS_REFUNDED, "refunded"),
223 (ORDER_ITEM_STATUS_RESTOCKED, "restocked"),
224 (ORDER_ITEM_STATUS_EXPIRED, "expired"),
225 (ORDER_ITEM_STATUS_INACTIVE, "inactive"),
226])
227"""
228Dict of possible code -> label options for :term:`order item` status.
230These codes are referenced by:
232* :attr:`sideshow.db.model.orders.OrderItem.status_code`
233"""
236########################################
237# Order Item Event Type
238########################################
240ORDER_ITEM_EVENT_INITIATED = 10
241"""
242Indicates the item was "initiated" - this occurs when the
243:term:`order` is first created.
244"""
246ORDER_ITEM_EVENT_PRICE_CONFIRMED = 20
247"""
248Indicates the item's price was confirmed by a user who is authorized
249to do that.
250"""
252ORDER_ITEM_EVENT_PAYMENT_RECEIVED = 50
253"""
254Indicates payment was received for the item. This may occur toward
255the beginning, or toward the end, of the item's life cycle depending
256on app configuration etc.
257"""
259# TODO: deprecate / remove this
260ORDER_ITEM_EVENT_PAID = ORDER_ITEM_EVENT_PAYMENT_RECEIVED
262ORDER_ITEM_EVENT_READY = 100
263"""
264Indicates the item has become "ready" for buyer placement on a new
265vendor purchase order. Often this will occur when the :term:`order`
266is first created, if the data is suitable. However this may be
267delayed if e.g. the price needs confirmation.
268"""
270ORDER_ITEM_EVENT_CUSTOMER_RESOLVED = 120
271"""
272Indicates the customer for the :term:`order` has been assigned to a
273"proper" (existing) account. This may happen (after the fact) if the
274order was first created with a new/unknown customer.
275"""
277ORDER_ITEM_EVENT_PRODUCT_RESOLVED = 140
278"""
279Indicates the product for the :term:`order item` has been assigned to
280a "proper" (existing) product record. This may happen (after the
281fact) if the order was first created with a new/unknown product.
282"""
284ORDER_ITEM_EVENT_PLACED = 200
285"""
286Indicates the buyer has placed a vendor purchase order which includes
287this item. So the item is "on order" until the truck arrives.
288"""
290ORDER_ITEM_EVENT_REORDER = 210
291"""
292Indicates the item was not received with the delivery on which it was
293expected, and must be re-ordered from vendor.
294"""
296ORDER_ITEM_EVENT_RECEIVED = 300
297"""
298Indicates the receiver has found the item while receiving a vendor
299delivery. The item is set aside and is "on hand" until customer comes
300in to pick it up.
301"""
303ORDER_ITEM_EVENT_CONTACTED = 350
304"""
305Indicates the customer has been contacted, to notify them of the item
306being on hand and ready for pickup.
307"""
309ORDER_ITEM_EVENT_CONTACT_FAILED = 375
310"""
311Indicates an attempt was made to contact the customer, to notify them
312of item being on hand, but the attempt failed, e.g. due to bad phone
313or email on file.
314"""
316ORDER_ITEM_EVENT_DELIVERED = 500
317"""
318Indicates the customer has picked up the item.
319"""
321ORDER_ITEM_EVENT_STATUS_CHANGE = 700
322"""
323Indicates a manual status change was made. Such an event should
324ideally contain a note with further explanation.
325"""
327ORDER_ITEM_EVENT_NOTE_ADDED = 750
328"""
329Indicates an arbitrary note was added.
330"""
332ORDER_ITEM_EVENT_CANCELED = 900
333"""
334Indicates the :term:`order item` was canceled.
335"""
337ORDER_ITEM_EVENT_REFUND_PENDING = 910
338"""
339Indicates the customer is due a (pending) refund for the item.
340"""
342ORDER_ITEM_EVENT_REFUNDED = 920
343"""
344Indicates the customer has been refunded for the item.
345"""
347ORDER_ITEM_EVENT_RESTOCKED = 930
348"""
349Indicates the product has been restocked, e.g. due to the order item
350being canceled.
351"""
353ORDER_ITEM_EVENT_EXPIRED = 940
354"""
355Indicates the order item (or its product) has expired.
356"""
358ORDER_ITEM_EVENT_INACTIVE = 950
359"""
360Indicates the order item has become inactive.
361"""
363ORDER_ITEM_EVENT_OTHER = 999
364"""
365Arbitrary event type which does not signify anything in particular.
366If used, the event should be given an explanatory note.
367"""
369ORDER_ITEM_EVENT = OrderedDict([
370 (ORDER_ITEM_EVENT_INITIATED, "initiated"),
371 (ORDER_ITEM_EVENT_PRICE_CONFIRMED, "price confirmed"),
372 (ORDER_ITEM_EVENT_PAYMENT_RECEIVED, "payment received"),
373 (ORDER_ITEM_EVENT_READY, "ready to proceed"),
374 (ORDER_ITEM_EVENT_CUSTOMER_RESOLVED, "customer resolved"),
375 (ORDER_ITEM_EVENT_PRODUCT_RESOLVED, "product resolved"),
376 (ORDER_ITEM_EVENT_PLACED, "placed with vendor"),
377 (ORDER_ITEM_EVENT_REORDER, "marked for re-order"),
378 (ORDER_ITEM_EVENT_RECEIVED, "received from vendor"),
379 (ORDER_ITEM_EVENT_CONTACTED, "customer contacted"),
380 (ORDER_ITEM_EVENT_CONTACT_FAILED, "contact failed"),
381 (ORDER_ITEM_EVENT_DELIVERED, "delivered"),
382 (ORDER_ITEM_EVENT_STATUS_CHANGE, "changed status"),
383 (ORDER_ITEM_EVENT_NOTE_ADDED, "added note"),
384 (ORDER_ITEM_EVENT_CANCELED, "canceled"),
385 (ORDER_ITEM_EVENT_REFUND_PENDING, "refund pending"),
386 (ORDER_ITEM_EVENT_REFUNDED, "refunded"),
387 (ORDER_ITEM_EVENT_RESTOCKED, "restocked"),
388 (ORDER_ITEM_EVENT_EXPIRED, "expired"),
389 (ORDER_ITEM_EVENT_INACTIVE, "inactive"),
390 (ORDER_ITEM_EVENT_OTHER, "other"),
391])
392"""
393Dict of possible code -> label options for :term:`order item` event
394types.
396These codes are referenced by:
398* :attr:`sideshow.db.model.orders.OrderItemEvent.type_code`
399"""