Subversion Repositories SmartDukaan

Rev

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

Rev 9404 Rev 9416
Line 204... Line 204...
204
    order.storeId = t_order.storeId
204
    order.storeId = t_order.storeId
205
    if t_order.productCondition:
205
    if t_order.productCondition:
206
        order.productCondition = t_order.productCondition
206
        order.productCondition = t_order.productCondition
207
    if t_order.dataProtectionInsurer:
207
    if t_order.dataProtectionInsurer:
208
        order.dataProtectionInsurer = t_order.dataProtectionInsurer
208
        order.dataProtectionInsurer = t_order.dataProtectionInsurer
209
        order.dataProtectionAmount = t_order.dataProtectionAmount 
209
        order.dataProtectionAmount = t_order.dataProtectionAmount
-
 
210
    if t_order.taxType:
-
 
211
        order.taxType = t_order.taxType 
210
    return order
212
    return order
211
    
213
    
212
def create_transaction(t_transaction):
214
def create_transaction(t_transaction):
213
    t_orders = t_transaction.orders
215
    t_orders = t_transaction.orders
214
    if not t_orders:
216
    if not t_orders:
Line 1355... Line 1357...
1355
    if parentOrder.cod and parentOrder.status!=12:
1357
    if parentOrder.cod and parentOrder.status!=12:
1356
        return False
1358
        return False
1357
    else:
1359
    else:
1358
        return True
1360
        return True
1359
 
1361
 
-
 
1362
def __getOrderTaxType(order):
-
 
1363
    delhiPincodePrefix = "11";
-
 
1364
    maharashtraPincodePrefix = ["40", "41", "42", "43", "44"];
-
 
1365
    
-
 
1366
    if order.warehouse_id == 7: 
-
 
1367
        if order.customer_pincode.startswith(delhiPincodePrefix):
-
 
1368
            return 0
-
 
1369
        else:
-
 
1370
            return 1
-
 
1371
    if order.warehouse_id == 12 or order.warehouse_id == 13:
-
 
1372
        for mahaPincodePrefix in maharashtraPincodePrefix:
-
 
1373
            if order.customer_pincode.startswith(mahaPincodePrefix):
-
 
1374
                return 0
-
 
1375
        return 1
-
 
1376
    raise TransactionServiceException(110, "No Vat/CST logic defined for warehouse " + str(order.warehouse_id)) 
-
 
1377
 
1360
def add_billing_details(orderId, invoice_number, serialNumbers, itemNumbers, freebieWarehouseId, billedBy, jacketNumber, billingType, fulfilmentWarehouseId, authorize):
1378
def add_billing_details(orderId, invoice_number, serialNumbers, itemNumbers, freebieWarehouseId, billedBy, jacketNumber, billingType, fulfilmentWarehouseId, authorize):
1361
    if billedBy is None or billedBy.strip() == "":
1379
    if billedBy is None or billedBy.strip() == "":
1362
        raise TransactionServiceException(110, "Invalid Biller")
1380
        raise TransactionServiceException(110, "Invalid Biller")
1363
    
1381
    
1364
    order = Order.get_by(id=orderId)
1382
    order = Order.get_by(id=orderId)
1365
    if not order:
1383
    if not order:
1366
        raise TransactionServiceException(101, "No order found for the given order id" + str(orderId))
1384
        raise TransactionServiceException(101, "No order found for the given order id" + str(orderId))
1367
    
1385
    
-
 
1386
    newTaxType = __getOrderTaxType(order)
-
 
1387
    if order.taxType == 2:
-
 
1388
        if newTaxType == 0:
-
 
1389
            raise TransactionServiceException(101, "C-Form billing is not allowed for same state for Order" + str(orderId))
-
 
1390
    else:
-
 
1391
        order.taxType = newTaxType
-
 
1392
    
-
 
1393
    
1368
    if jacketNumber is None or jacketNumber <= 0:
1394
    if jacketNumber is None or jacketNumber <= 0:
1369
        if order.source == OrderSource.EBAY or order.source == OrderSource.SNAPDEAL or order.source == OrderSource.FLIPKART:
1395
        if order.source == OrderSource.EBAY or order.source == OrderSource.SNAPDEAL or order.source == OrderSource.FLIPKART:
1370
            print "Skipping Jacket Number field for OrderId " + str(orderId)
1396
            print "Skipping Jacket Number field for OrderId " + str(orderId)
1371
        else:
1397
        else:
1372
            raise TransactionServiceException(110, "Invalid jacket number")
1398
            raise TransactionServiceException(110, "Invalid jacket number")
Line 2390... Line 2416...
2390
        order.received_return_timestamp = datetime.datetime.now()
2416
        order.received_return_timestamp = datetime.datetime.now()
2391
    elif order.status == OrderStatus.RTO_IN_TRANSIT :
2417
    elif order.status == OrderStatus.RTO_IN_TRANSIT :
2392
        if receiveCondition == 0:
2418
        if receiveCondition == 0:
2393
            order.status = OrderStatus.RTO_RECEIVED_PRESTINE
2419
            order.status = OrderStatus.RTO_RECEIVED_PRESTINE
2394
            order.statusDescription = "Returned to origin"
2420
            order.statusDescription = "Returned to origin"
-
 
2421
            if order.freebieItemId:
-
 
2422
                scanFreebie = True
2395
        elif receiveCondition == 1:
2423
        elif receiveCondition == 1:
2396
            order.status = OrderStatus.RTO_RECEIVED_DAMAGED
2424
            order.status = OrderStatus.RTO_RECEIVED_DAMAGED
2397
            order.statusDescription = "RTO received damaged"
2425
            order.statusDescription = "RTO received damaged"
2398
        elif receiveCondition == 2:
2426
        elif receiveCondition == 2:
2399
            order.status = OrderStatus.RTO_LOST_IN_TRANSIT
2427
            order.status = OrderStatus.RTO_LOST_IN_TRANSIT
2400
            order.statusDescription = "RTO lost in transit"
2428
            order.statusDescription = "RTO lost in transit"
2401
        order.received_return_timestamp = datetime.datetime.now()
2429
        order.received_return_timestamp = datetime.datetime.now()
2402
        if order.freebieItemId:
-
 
2403
            scanFreebie = True
2430
       
2404
    else:
2431
    else:
2405
        return False
2432
        return False
2406
 
2433
 
2407
    # For OUR warehouses, we need to scan in items for every return
2434
    # For OUR warehouses, we need to scan in items for every return
2408
    inventoryClient = InventoryClient().get_client()
2435
    inventoryClient = InventoryClient().get_client()