Changeset - 936980f28077
[Not reviewed]
0 2 0
Lance Edgar (lance) - 7 years ago 2017-08-15 12:56:53
lance@edbob.org
Add enum for purchase credit status
2 files changed with 12 insertions and 0 deletions:
0 comments (0 inline, 0 general)
rattail/batch/purchase.py
Show inline comments
 
@@ -227,12 +227,13 @@ class PurchaseBatchHandler(BatchHandler):
 
        def copy(row, i):
 
            for batch_credit in row.credits:
 
                credit = model.PurchaseCredit()
 
                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,
 
                                  message="Creating purchase credits")
 

	
 
    def make_purchase(self, batch, user, progress=None):
rattail/enum.py
Show inline comments
 
@@ -154,12 +154,23 @@ PURCHASE_BATCH_MODE = {
 
    PURCHASE_BATCH_MODE_ORDERING        : "ordering",
 
    PURCHASE_BATCH_MODE_RECEIVING       : "receiving",
 
    PURCHASE_BATCH_MODE_COSTING         : "invoicing",
 
}
 

	
 

	
 
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
 
PURCHASE_STATUS_COSTED          = 30
 
PURCHASE_STATUS_PAID            = 40
 

	
0 comments (0 inline, 0 general)