Coverage for src/sideshow/enum.py: 100%
39 statements
« prev ^ index » next coverage.py v7.6.10, created at 2025-01-05 20:55 -0600
« prev ^ index » next coverage.py v7.6.10, created at 2025-01-05 20:55 -0600
1# -*- coding: utf-8; -*-
2################################################################################
3#
4# Sideshow -- Case/Special Order Tracker
5# Copyright © 2024 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'
96class PendingProductStatus(Enum):
97 """
98 Enum values for
99 :attr:`sideshow.db.model.products.PendingProduct.status`.
100 """
101 PENDING = 'pending'
102 READY = 'ready'
103 RESOLVED = 'resolved'
106########################################
107# Order Item Status
108########################################
110ORDER_ITEM_STATUS_UNINITIATED = 1
111ORDER_ITEM_STATUS_INITIATED = 10
112ORDER_ITEM_STATUS_PAID_BEFORE = 50
113# TODO: deprecate / remove this one
114ORDER_ITEM_STATUS_PAID = ORDER_ITEM_STATUS_PAID_BEFORE
115ORDER_ITEM_STATUS_READY = 100
116ORDER_ITEM_STATUS_PLACED = 200
117ORDER_ITEM_STATUS_RECEIVED = 300
118ORDER_ITEM_STATUS_CONTACTED = 350
119ORDER_ITEM_STATUS_CONTACT_FAILED = 375
120ORDER_ITEM_STATUS_DELIVERED = 500
121ORDER_ITEM_STATUS_PAID_AFTER = 550
122ORDER_ITEM_STATUS_CANCELED = 900
123ORDER_ITEM_STATUS_REFUND_PENDING = 910
124ORDER_ITEM_STATUS_REFUNDED = 920
125ORDER_ITEM_STATUS_RESTOCKED = 930
126ORDER_ITEM_STATUS_EXPIRED = 940
127ORDER_ITEM_STATUS_INACTIVE = 950
129ORDER_ITEM_STATUS = OrderedDict([
130 (ORDER_ITEM_STATUS_UNINITIATED, "uninitiated"),
131 (ORDER_ITEM_STATUS_INITIATED, "initiated"),
132 (ORDER_ITEM_STATUS_PAID_BEFORE, "paid"),
133 (ORDER_ITEM_STATUS_READY, "ready"),
134 (ORDER_ITEM_STATUS_PLACED, "placed"),
135 (ORDER_ITEM_STATUS_RECEIVED, "received"),
136 (ORDER_ITEM_STATUS_CONTACTED, "contacted"),
137 (ORDER_ITEM_STATUS_CONTACT_FAILED, "contact failed"),
138 (ORDER_ITEM_STATUS_DELIVERED, "delivered"),
139 (ORDER_ITEM_STATUS_PAID_AFTER, "paid"),
140 (ORDER_ITEM_STATUS_CANCELED, "canceled"),
141 (ORDER_ITEM_STATUS_REFUND_PENDING, "refund pending"),
142 (ORDER_ITEM_STATUS_REFUNDED, "refunded"),
143 (ORDER_ITEM_STATUS_RESTOCKED, "restocked"),
144 (ORDER_ITEM_STATUS_EXPIRED, "expired"),
145 (ORDER_ITEM_STATUS_INACTIVE, "inactive"),
146])