Subversion Repositories SmartDukaan

Rev

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

Rev 7611 Rev 7628
Line 2138... Line 2138...
2138
        to_addr = order.customer_email
2138
        to_addr = order.customer_email
2139
        today = date.today().strftime("%d-%B-%Y (%A)")
2139
        today = date.today().strftime("%d-%B-%Y (%A)")
2140
 
2140
 
2141
        raw_message = '''
2141
        raw_message = '''
2142
        Dear Mr. %(customer_name)s,
2142
        Dear Mr. %(customer_name)s,
2143
 
2143
        
2144
        In reference to the return of order ID %(order_id)d, ''' + __generate_mail_body_for_authorize_pickup(order)
2144
        Would like to inform you that we have instructed %(provider_name)s to pick up the material from the below mentioned address on %(date)s. %(provider_name)s pickup request number is %(pickup_request_no)s.'
2145
        raw_message = raw_message + '''
2145
        
2146
        Take a printout of the attachment in this mail which contains the delivery address and paste it on the packed parcel.
2146
        Take a printout of the attachment in this mail which contains the delivery address and paste it on the packed parcel. Kindly keep the parcel ready.
2147
        We have instructed %(provider_name)s to pick up the material from the below mentioned address on %(date)s. %(provider_name)s pickup request number is %(pickup_request_no)s. Kindly keep the parcel ready.
-
 
2148
 
2147
 
2149
        Pickup will happen from the below mentioned address:-
2148
        Pickup will happen from the below mentioned address:-
2150
 
2149
 
2151
        %(customer_address)s
2150
        %(customer_address)s
2152
 
2151
 
Line 2181... Line 2180...
2181
        return False
2180
        return False
2182
    finally:
2181
    finally:
2183
        if os.path.exists(filename):
2182
        if os.path.exists(filename):
2184
            os.remove(filename)
2183
            os.remove(filename)
2185
 
2184
 
2186
def __generate_mail_body_for_authorize_pickup(order):
-
 
2187
    brand_msgbody_map = {'Nokia' : 'we request you to kindly pack the box properly with bubble wrap, and send it along with the all original accessories, original handset and the invoice.',
-
 
2188
                         'Micromax' : 'we request you to kindly pack the box properly with bubble wrap, and send it along with the all original accessories, original handset and the invoice.',
-
 
2189
                         'Karbonn' : 'we request you to kindly pack the box properly with bubble wrap, and send it along with the all original accessories, original handset and the invoice.',
-
 
2190
                         'Sony Ericsson' : 'we request you to kindly pack the original DOA certificate and the invoice.',
-
 
2191
                         'Others Handsets' : 'we request you to kindly pack the box properly with bubble wrap, and send it along with the original "DOA" certificate and the invoice. Please paste the original DOA on the sealed box. Kindly ensure that the product is properly sealed. If we receive open sealed products, we will not be able to accept.',
-
 
2192
                         'Handsets Return' : 'we request you to kindly pack the box properly with bubble wrap, and send it along with the all original accessories, original handset and the invoice.',
-
 
2193
                         'Accessories' : 'we request you to kindly pack the box properly with bubble wrap, and send it along with the original product and the invoice.'}
-
 
2194
    categories = ["Handsets", "Tablets", "Laptops"]
-
 
2195
    lineitem = order.lineitems[0]
-
 
2196
    brand = lineitem.brand
-
 
2197
    productGroup = lineitem.productGroup
-
 
2198
    searchkey = None
-
 
2199
    if productGroup not in categories:
-
 
2200
        searchkey = 'Accessories'
-
 
2201
    elif order.status == OrderStatus.RET_PICKUP_REQUEST_RAISED:
-
 
2202
        searchkey = 'Handsets Return'
-
 
2203
    elif brand == 'Nokia':
-
 
2204
        searchkey = 'Nokia'
-
 
2205
    elif brand == 'Micromax':
-
 
2206
        searchkey = 'Micromax'
-
 
2207
    elif brand == 'Karbonn':
-
 
2208
        searchkey = 'Karbonn'
-
 
2209
    elif brand == 'Sony Ericsson':
-
 
2210
        searchkey = 'Sony Ericsson'
-
 
2211
    else:
-
 
2212
        searchkey = 'Others Handsets'
-
 
2213
    return brand_msgbody_map.get(searchkey)
-
 
2214
 
-
 
2215
def mark_doas_as_picked_up(provider_id, pickup_details):
2185
def mark_doas_as_picked_up(provider_id, pickup_details):
2216
    for pickupNo, doa_pickup_timestamp in pickup_details.iteritems():
2186
    for pickupNo, doa_pickup_timestamp in pickup_details.iteritems():
2217
        order = Order.query.filter_by(pickupRequestNo=pickupNo, doa_logistics_provider_id = provider_id).first()
2187
        order = Order.query.filter_by(pickupRequestNo=pickupNo, doa_logistics_provider_id = provider_id).first()
2218
        if order == None or order.status != OrderStatus.DOA_PICKUP_CONFIRMED:
2188
        if order == None or order.status != OrderStatus.DOA_PICKUP_CONFIRMED:
2219
            #raise TransactionServiceException(102, "No order found for the awb: " + awb)
2189
            #raise TransactionServiceException(102, "No order found for the awb: " + awb)