Subversion Repositories SmartDukaan

Rev

Rev 1149 | Rev 1217 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1149 Rev 1208
Line 199... Line 199...
199
    if end_billing_date:
199
    if end_billing_date:
200
        query = query.filter(Order.billing_timestamp <= end_billing_date)
200
        query = query.filter(Order.billing_timestamp <= end_billing_date)
201
    
201
    
202
    return query.all()
202
    return query.all()
203
 
203
 
-
 
204
def get_orders_for_transaction(transaction_id):
-
 
205
    orders = Order.query.filter_by(transaction_id=transaction_id).all()
-
 
206
    if not orders:
-
 
207
        raise TransactionServiceException(101, "No order for the transaction")
-
 
208
    return orders
-
 
209
 
-
 
210
def get_line_items_for_order(order_id):
-
 
211
    query = LineItem.query.filter(LineItem.order_id == order_id)
-
 
212
    return query.all()
-
 
213
 
204
def change_order_status(self, orderId, status, description):
214
def change_order_status(self, orderId, status, description):
205
    order = get_order(orderId)
215
    order = get_order(orderId)
206
    order.status = status
216
    order.status = status
207
    order.statusDescription = description
217
    order.statusDescription = description
208
    session.commit()
218
    session.commit()
Line 220... Line 230...
220
    order = get_order(orderId)
230
    order = get_order(orderId)
221
    order.status = OrderStatus.BILLED
231
    order.status = OrderStatus.BILLED
222
    order.statusDescription = "Order Billed"
232
    order.statusDescription = "Order Billed"
223
    order.billing_timestamp = datetime.datetime.now()
233
    order.billing_timestamp = datetime.datetime.now()
224
    session.commit()
234
    session.commit()
225
    return True    
235
    return True
226
 
-
 
227
def get_orders_for_transaction(transaction_id):
-
 
228
    orders = Order.query.filter_by(transaction_id=transaction_id).all()
-
 
229
    if not orders:
-
 
230
        raise TransactionServiceException(101, "No order for the transaction")
-
 
231
    return orders
-
 
232
 
-
 
233
def get_line_items_for_order(order_id):
-
 
234
    query = LineItem.query.filter(LineItem.order_id == order_id)
-
 
235
    return query.all()
-
 
236
 
236
 
-
 
237
def order_outofstock(orderId):
-
 
238
    order = get_order(orderId)
-
 
239
    order.status = OrderStatus.INVENTORY_LOW
-
 
240
    order.statusDescription = "Low Inventory"
-
 
241
    order.outofstock_timestamp = datetime.datetime.now()
-
 
242
    session.commit()
-
 
243
    return True
237
 
244
 
238
def add_billing_details(orderId, invoice_number, billed_by):
245
def add_billing_details(orderId, invoice_number, billed_by):
239
    order = Order.get_by(id=orderId)
246
    order = Order.get_by(id=orderId)
240
    if not order:
247
    if not order:
241
        raise TransactionServiceException(101, "No order found for the givem orderid")
248
        raise TransactionServiceException(101, "No order found for the givem orderid")