Subversion Repositories SmartDukaan

Rev

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

Rev 6007 Rev 6019
Line 732... Line 732...
732
    existingAttribute = Attribute.query.filter(Attribute.orderId == order_id).filter(Attribute.name == attribute_name).first()
732
    existingAttribute = Attribute.query.filter(Attribute.orderId == order_id).filter(Attribute.name == attribute_name).first()
733
    if existingAttribute:
733
    if existingAttribute:
734
        return existingAttribute.value
734
        return existingAttribute.value
735
    return ""
735
    return ""
736
 
736
 
-
 
737
def change_jacket_number(order_id, jacket_number):
-
 
738
    order = get_order(order_id)
-
 
739
    if order.status == OrderStatus.BILLED:
-
 
740
        order.jacket_number = jacket_number
-
 
741
        return True
-
 
742
    return False
-
 
743
 
-
 
744
def mark_order_as_rto_in_transit(order_id):
-
 
745
    order = get_order(order_id)
-
 
746
    if order == None or order.status not in [OrderStatus.SHIPPED_FROM_WH, OrderStatus.DELIVERED_AT_STORE, OrderStatus.SHIPPED_TO_LOGST, OrderStatus.SHIPPED_TO_DESTINATION_CITY, OrderStatus.REACHED_DESTINATION_CITY, OrderStatus.FIRST_DELIVERY_ATTEMPT_MADE]:
-
 
747
        return False
-
 
748
    order.status = OrderStatus.RTO_IN_TRANSIT
-
 
749
    order.delivery_timestamp = datetime.datetime.now()
-
 
750
    order.statusDescription = "Order Returned to Origin:"
-
 
751
    update_trust_level(order)
-
 
752
    return True
-
 
753
    
737
def get_order(order_id):
754
def get_order(order_id):
738
    order = Order.get_by(id=order_id)
755
    order = Order.get_by(id=order_id)
739
    if not order:
756
    if not order:
740
        raise TransactionServiceException(108, "no such order")
757
        raise TransactionServiceException(108, "no such order")
741
    
758
    
Line 2548... Line 2565...
2548
def change_warehouse(order_id, warehouse_id):
2565
def change_warehouse(order_id, warehouse_id):
2549
    '''
2566
    '''
2550
    Update the warehouse which will be used to fulfil this order.
2567
    Update the warehouse which will be used to fulfil this order.
2551
    '''
2568
    '''
2552
    order = get_order(order_id)
2569
    order = get_order(order_id)
2553
    if order.status not in [OrderStatus.COD_VERIFICATION_PENDING, OrderStatus.SUBMITTED_FOR_PROCESSING, OrderStatus.INVENTORY_LOW, OrderStatus.LOW_INV_PO_RAISED, OrderStatus.LOW_INV_REVERSAL_IN_PROCESS, OrderStatus.LOW_INV_NOT_AVAILABLE_AT_HOTSPOT]:
2570
    if order.status not in [OrderStatus.COD_VERIFICATION_PENDING, OrderStatus.SUBMITTED_FOR_PROCESSING, OrderStatus.INVENTORY_LOW, OrderStatus.LOW_INV_PO_RAISED, OrderStatus.LOW_INV_REVERSAL_IN_PROCESS, OrderStatus.LOW_INV_NOT_AVAILABLE_AT_HOTSPOT, OrderStatus.ACCEPTED]:
2554
        raise TransactionServiceException(117, "This order has already been processed. Please seek help from engineering.")
2571
        raise TransactionServiceException(117, "This order has already been processed. Please seek help from engineering.")
2555
         
2572
         
2556
    if warehouse_id == order.warehouse_id:
2573
    if warehouse_id == order.warehouse_id:
2557
        raise TransactionServiceException(118, "You have selected the current warehouse again. Nothing to do")
2574
        raise TransactionServiceException(118, "You have selected the current warehouse again. Nothing to do")
2558
 
2575