Subversion Repositories SmartDukaan

Rev

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

Rev 5823 Rev 5824
Line 1170... Line 1170...
1170
            mail(from_user, from_pwd, to_addresses, subject, message)
1170
            mail(from_user, from_pwd, to_addresses, subject, message)
1171
            
1171
            
1172
def mark_orders_as_returned_from_store(providerId, orderIds, awbs):
1172
def mark_orders_as_returned_from_store(providerId, orderIds, awbs):
1173
    try:
1173
    try:
1174
        current_timestamp = datetime.datetime.now()
1174
        current_timestamp = datetime.datetime.now()
1175
        orders = Order.query.filter_by(logistics_provider_id = providerId, status = OrderStatus.RET_PICKUP_REQUEST_RAISED).all()
1175
        orders = Order.query.filter(Order.id.in_(orderIds)).filter_by(logistics_provider_id = providerId, status = OrderStatus.RET_PICKUP_REQUEST_RAISED).all()
1176
        for order in orders:
1176
        for order in orders:
1177
            if order.id in orderIds:
-
 
1178
                order.status = OrderStatus.RET_RETURN_IN_TRANSIT
1177
            order.status = OrderStatus.RET_RETURN_IN_TRANSIT
1179
                order.statusDescription = "Order returned from store"
1178
            order.statusDescription = "Order returned from store"
1180
                order.doa_pickup_timestamp = current_timestamp
1179
            order.doa_pickup_timestamp = current_timestamp
1181
                #order.airwaybill_no = awbs[orderIds.index(order.id)]
1180
            #order.airwaybill_no = awbs[orderIds.index(order.id)]
1182
                order.tracking_id = awbs[orderIds.index(order.id)]
1181
            order.tracking_id = awbs[orderIds.index(order.id)]
1183
        session.commit()
1182
        session.commit()
1184
        
1183
        
1185
        return True
1184
        return True
1186
    except:
1185
    except:
1187
        return False    
1186
        return False