Subversion Repositories SmartDukaan

Rev

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

Rev 21099 Rev 21102
Line 100... Line 100...
100
    c_3, idx = sub_address(address_string, idx, len(add_string))
100
    c_3, idx = sub_address(address_string, idx, len(add_string))
101
    consignee.ConsigneeAddress1 = c_1.strip()
101
    consignee.ConsigneeAddress1 = c_1.strip()
102
    consignee.ConsigneeAddress2 = c_2.strip()
102
    consignee.ConsigneeAddress2 = c_2.strip()
103
    consignee.ConsigneeAddress3 = (c_3 +" "+order.customer_city).strip()
103
    consignee.ConsigneeAddress3 = (c_3 +" "+order.customer_city).strip()
104
    return consignee
104
    return consignee
-
 
105
        
105
 
106
 
106
def sub_address(add_str, previous_loc, final_loc):
107
def sub_address(add_str, previous_loc, final_loc):
107
    sub = add_str[previous_loc:final_loc]
108
    sub = add_str[previous_loc:final_loc]
108
    max_idx = sub.rfind(" ")
109
    max_idx = sub.rfind(" ")
109
    if max_idx==-1:
110
    if max_idx==-1:
110
        return sub, len(sub)
111
        return sub, len(sub)
111
    if max_idx == (final_loc-1):
112
    if max_idx == (final_loc-1):
112
        return sub
113
        return sub, final_loc-1
113
    return sub[: max_idx], max_idx+previous_loc
114
    return sub[: max_idx], max_idx+previous_loc
114
 
115
 
115
def get_shipment_details(logisticsTxnId):
116
def get_shipment_details(logisticsTxnId):
116
    tc = TransactionClient().get_client()
117
    tc = TransactionClient().get_client()
117
    shipment_cost_detail = tc.getCostDetailForLogisticsTxnId(logisticsTxnId)
118
    shipment_cost_detail = tc.getCostDetailForLogisticsTxnId(logisticsTxnId)
118
    return shipment_cost_detail
119
    return shipment_cost_detail
119
    
120
    
120
 
121
 
121
def generate_awb(orders_list):
122
def generate_awb(orders_list):
-
 
123
    print "******",len(orders_list)
-
 
124
    print "******",orders_list[0].__dict__
122
    try:
125
    try:
123
        if not isinstance(orders_list, list) or not orders_list:
126
        if not isinstance(orders_list, list) or not orders_list:
124
            raise ValueError("Expecting list of orders")
127
            raise ValueError("Expecting list of orders")
125
        consignee = get_client().factory.create('ns2:Consignee')
128
        consignee = get_client().factory.create('ns2:Consignee')
126
        consignee = clean_address(orders_list[0], consignee)
129
        consignee = clean_address(orders_list[0], consignee)