From 936980f28077679988424b845400e399f50f980a 2017-08-15 12:56:53 From: Lance Edgar Date: 2017-08-15 12:56:53 Subject: [PATCH] Add enum for purchase credit status --- diff --git a/rattail/batch/purchase.py b/rattail/batch/purchase.py index 2dbf1e2efad3892e00d20b5f4cfdb2fe34db83d0..f9d0dff11471d8055c0fee62085bf822af5e215c 100644 --- a/rattail/batch/purchase.py +++ b/rattail/batch/purchase.py @@ -230,6 +230,7 @@ class PurchaseBatchHandler(BatchHandler): for prop in mapper.iterate_properties: if isinstance(prop, orm.ColumnProperty) and hasattr(credit, prop.key): setattr(credit, prop.key, getattr(batch_credit, prop.key)) + credit.status = self.enum.PURCHASE_CREDIT_STATUS_NEW session.add(credit) return self.progress_loop(copy, batch.active_rows(), progress, diff --git a/rattail/enum.py b/rattail/enum.py index 6f8aeda4bbb0e2129fc299b8136602d39245044f..31f4738af7c24d8f884c7c481049998072d08594 100644 --- a/rattail/enum.py +++ b/rattail/enum.py @@ -157,6 +157,17 @@ PURCHASE_BATCH_MODE = { } +PURCHASE_CREDIT_STATUS_NEW = 10 +PURCHASE_CREDIT_STATUS_SUBMITTED = 20 +PURCHASE_CREDIT_STATUS_SATISFIED = 30 + +PURCHASE_CREDIT_STATUS = { + PURCHASE_CREDIT_STATUS_NEW : "new", + PURCHASE_CREDIT_STATUS_SUBMITTED : "submitted", + PURCHASE_CREDIT_STATUS_SATISFIED : "satisfied", +} + + PURCHASE_STATUS_NEW = 1 # TODO: is this needed? PURCHASE_STATUS_ORDERED = 10 PURCHASE_STATUS_RECEIVED = 20