Add "all" enum values for custorder item status, event
also attach "initiated" event(s) when creating new custorder
This commit is contained in:
parent
39504fdec9
commit
25483a21a0
|
@ -381,11 +381,16 @@ class CustomerOrderBatchHandler(BatchHandler):
|
|||
def convert(row, i):
|
||||
item = model.CustomerOrderItem()
|
||||
item.sequence = i
|
||||
item.status_code = self.enum.CUSTORDER_ITEM_STATUS_ORDERED
|
||||
item.status_code = self.enum.CUSTORDER_ITEM_STATUS_INITIATED
|
||||
for field in row_fields:
|
||||
setattr(item, field, getattr(row, field))
|
||||
order.items.append(item)
|
||||
|
||||
# attach event
|
||||
item.events.append(model.CustomerOrderItemEvent(
|
||||
type_code=self.enum.CUSTORDER_ITEM_EVENT_INITIATED,
|
||||
user=user))
|
||||
|
||||
self.progress_loop(convert, batch.active_rows(), progress,
|
||||
message="Converting batch rows to order items")
|
||||
|
||||
|
|
|
@ -56,6 +56,8 @@ The following enumerations are provided:
|
|||
|
||||
from __future__ import unicode_literals, absolute_import
|
||||
|
||||
from rattail.util import OrderedDict
|
||||
|
||||
|
||||
BATCH_ACTION_ADD = 'ADD'
|
||||
BATCH_ACTION_ADD_REPLACE = 'ADDRPL'
|
||||
|
@ -90,13 +92,70 @@ CUSTORDER_STATUS = {
|
|||
}
|
||||
|
||||
|
||||
CUSTORDER_ITEM_STATUS_ORDERED = 10
|
||||
# CUSTORDER_ITEM_STATUS_PAID = 20
|
||||
CUSTORDER_ITEM_STATUS_INITIATED = 10
|
||||
# TODO: deprecate / remove this one
|
||||
CUSTORDER_ITEM_STATUS_ORDERED = CUSTORDER_ITEM_STATUS_INITIATED
|
||||
CUSTORDER_ITEM_STATUS_PAID = 20
|
||||
CUSTORDER_ITEM_STATUS_PLACED = 30
|
||||
CUSTORDER_ITEM_STATUS_RECEIVED = 40
|
||||
CUSTORDER_ITEM_STATUS_CONTACTED = 50
|
||||
CUSTORDER_ITEM_STATUS_CONTACT_FAILED = 60
|
||||
CUSTORDER_ITEM_STATUS_DELIVERED = 70
|
||||
CUSTORDER_ITEM_STATUS_CANCELED = 900
|
||||
CUSTORDER_ITEM_STATUS_REFUND_PENDING = 910
|
||||
CUSTORDER_ITEM_STATUS_REFUNDED = 920
|
||||
CUSTORDER_ITEM_STATUS_RESTOCKED = 930
|
||||
CUSTORDER_ITEM_STATUS_EXPIRED = 940
|
||||
CUSTORDER_ITEM_STATUS_INACTIVE = 950
|
||||
|
||||
CUSTORDER_ITEM_STATUS = {
|
||||
CUSTORDER_ITEM_STATUS_ORDERED : "ordered",
|
||||
# CUSTORDER_ITEM_STATUS_PAID : "paid",
|
||||
}
|
||||
CUSTORDER_ITEM_STATUS = OrderedDict([
|
||||
(CUSTORDER_ITEM_STATUS_INITIATED, "customer order initiated"),
|
||||
(CUSTORDER_ITEM_STATUS_PAID, "payment received"),
|
||||
(CUSTORDER_ITEM_STATUS_PLACED, "order placed with vendor"),
|
||||
(CUSTORDER_ITEM_STATUS_RECEIVED, "received from vendor"),
|
||||
(CUSTORDER_ITEM_STATUS_CONTACTED, "customer contacted"),
|
||||
(CUSTORDER_ITEM_STATUS_CONTACT_FAILED, "unable to contact customer"),
|
||||
(CUSTORDER_ITEM_STATUS_DELIVERED, "delivered to customer"),
|
||||
(CUSTORDER_ITEM_STATUS_CANCELED, "canceled"),
|
||||
(CUSTORDER_ITEM_STATUS_REFUND_PENDING, "refund pending"),
|
||||
(CUSTORDER_ITEM_STATUS_REFUNDED, "refunded"),
|
||||
(CUSTORDER_ITEM_STATUS_RESTOCKED, "restocked"),
|
||||
(CUSTORDER_ITEM_STATUS_EXPIRED, "expired"),
|
||||
(CUSTORDER_ITEM_STATUS_INACTIVE, "inactive"),
|
||||
])
|
||||
|
||||
|
||||
CUSTORDER_ITEM_EVENT_INITIATED = 10
|
||||
CUSTORDER_ITEM_EVENT_PAID = 20
|
||||
CUSTORDER_ITEM_EVENT_PLACED = 30
|
||||
CUSTORDER_ITEM_EVENT_RECEIVED = 40
|
||||
CUSTORDER_ITEM_EVENT_CONTACTED = 50
|
||||
CUSTORDER_ITEM_EVENT_CONTACT_FAILED = 60
|
||||
CUSTORDER_ITEM_EVENT_DELIVERED = 70
|
||||
CUSTORDER_ITEM_EVENT_STATUS_CHANGE = 500 # nb. this is not in STATUS enum
|
||||
CUSTORDER_ITEM_EVENT_CANCELED = 900
|
||||
CUSTORDER_ITEM_EVENT_REFUND_PENDING = 910
|
||||
CUSTORDER_ITEM_EVENT_REFUNDED = 920
|
||||
CUSTORDER_ITEM_EVENT_RESTOCKED = 930
|
||||
CUSTORDER_ITEM_EVENT_EXPIRED = 940
|
||||
CUSTORDER_ITEM_EVENT_INACTIVE = 950
|
||||
|
||||
CUSTORDER_ITEM_EVENT = OrderedDict([
|
||||
(CUSTORDER_ITEM_EVENT_INITIATED, "customer order initiated"),
|
||||
(CUSTORDER_ITEM_EVENT_PAID, "payment received"),
|
||||
(CUSTORDER_ITEM_EVENT_PLACED, "order placed with vendor"),
|
||||
(CUSTORDER_ITEM_EVENT_RECEIVED, "received from vendor"),
|
||||
(CUSTORDER_ITEM_EVENT_CONTACTED, "customer contacted"),
|
||||
(CUSTORDER_ITEM_EVENT_CONTACT_FAILED, "unable to contact customer"),
|
||||
(CUSTORDER_ITEM_EVENT_DELIVERED, "delivered to customer"),
|
||||
(CUSTORDER_ITEM_EVENT_STATUS_CHANGE, "manual status change"),
|
||||
(CUSTORDER_ITEM_EVENT_CANCELED, "canceled"),
|
||||
(CUSTORDER_ITEM_EVENT_REFUND_PENDING, "refund pending"),
|
||||
(CUSTORDER_ITEM_EVENT_REFUNDED, "refunded"),
|
||||
(CUSTORDER_ITEM_EVENT_RESTOCKED, "restocked"),
|
||||
(CUSTORDER_ITEM_EVENT_EXPIRED, "expired"),
|
||||
(CUSTORDER_ITEM_EVENT_INACTIVE, "inactive"),
|
||||
])
|
||||
|
||||
|
||||
EMAIL_ATTEMPT_CREATED = 0
|
||||
|
|
Loading…
Reference in a new issue