Subversion Repositories SmartDukaan

Rev

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

Rev 21844 Rev 21854
Line 3198... Line 3198...
3198
    invoice_number = entity_id.id + 1
3198
    invoice_number = entity_id.id + 1
3199
    entity_id.id = invoice_number
3199
    entity_id.id = invoice_number
3200
    return invoice_number
3200
    return invoice_number
3201
 
3201
 
3202
def get_next_invoice_counter(seller_id, warehouse_id, orderType):
3202
def get_next_invoice_counter(seller_id, warehouse_id, orderType):
-
 
3203
    #Sequence would now be maintained through single order for seller
3203
    if OrderType.B2Cbulk == orderType:
3204
    if OrderType.B2Cbulk == orderType:
3204
        orderType = OrderType.B2C
3205
        orderType = OrderType.B2C
3205
    #entity_id = InvoiceCounterGenerator.query.filter(InvoiceCounterGenerator.orderType == orderType).filter(InvoiceCounterGenerator.stateId == stateId).filter(InvoiceCounterGenerator.companyId==companyId).with_lockmode("update").one()
3206
    #entity_id = InvoiceCounterGenerator.query.filter(InvoiceCounterGenerator.orderType == orderType).filter(InvoiceCounterGenerator.stateId == stateId).filter(InvoiceCounterGenerator.companyId==companyId).with_lockmode("update").one()
3206
    entity_id = SellerWarehouse.query.filter(SellerWarehouse.orderType == orderType).filter(SellerWarehouse.warehouse_id == warehouse_id).filter(SellerWarehouse.seller_id==seller_id).with_lockmode("update").one()
3207
    entity_id = SellerWarehouse.query.filter(SellerWarehouse.warehouse_id == warehouse_id).filter(SellerWarehouse.seller_id==seller_id).with_lockmode("update").one()
3207
    invoice_number = entity_id.id + 1
3208
    invoice_number = entity_id.id + 1
3208
    entity_id.id = invoice_number 
3209
    entity_id.id = invoice_number 
3209
    ret_invoiceNo = entity_id.prefix + str(invoice_number) 
3210
    ret_invoiceNo = entity_id.prefix + str(invoice_number) 
3210
    return ret_invoiceNo
3211
    return ret_invoiceNo
3211
 
3212
 
Line 8972... Line 8973...
8972
    lineItemSize = 0
8973
    lineItemSize = 0
8973
    individualInvoice = True
8974
    individualInvoice = True
8974
    warehouse = inventory_client.getWarehouse(ordersList[0].warehouse_id)
8975
    warehouse = inventory_client.getWarehouse(ordersList[0].warehouse_id)
8975
    whState = fetchStateMaster().get(warehouse.stateId)
8976
    whState = fetchStateMaster().get(warehouse.stateId)
8976
     
8977
     
8977
    newTaxType = __getOrderTaxType(ordersList[0], whState.name)    
8978
    taxType = __getOrderTaxType(ordersList[0], whState.stateName)
-
 
8979
    
-
 
8980
    if not catalog_client.isAlive():
-
 
8981
        catalog_client = CatalogClient().get_client()
-
 
8982
        catalog_client.ge
-
 
8983
    if taxType == TaxType.IGST:
-
 
8984
        gstRatesMap = catalog_client.getInterStateGstRates()
-
 
8985
    else:
-
 
8986
        gstRatesMap = catalog_client.getGstRatesByState(whState.id).gstRatesMap
-
 
8987
    
-
 
8988
        
8978
    orderscansMap = {}
8989
    orderscansMap = {}
8979
    orderInventoryItemMap = {}
8990
    orderInventoryItemMap = {}
8980
    orderFulfilmentWarehouseMap = {}
8991
    orderFulfilmentWarehouseMap = {}
8981
    nonSerializedUsedInventoryMap = {}
8992
    nonSerializedUsedInventoryMap = {}
8982
    for order in ordersList:
8993
    for order in ordersList:
8983
        scanList = []
8994
        scanList = []
8984
        inventoryItemList = []
8995
        inventoryItemList = []
8985
        order.taxType = newTaxType
8996
        order.taxType = taxType
8986
        if jacketNumber is None or jacketNumber <= 0:
8997
        if jacketNumber is None or jacketNumber <= 0:
8987
            if order.source == OrderSource.EBAY or order.source == OrderSource.SNAPDEAL or order.source == OrderSource.FLIPKART:
8998
            if order.source == OrderSource.EBAY or order.source == OrderSource.SNAPDEAL or order.source == OrderSource.FLIPKART:
8988
                print "Skipping Jacket Number field for OrderId " + str(orderId)
8999
                print "Skipping Jacket Number field for OrderId " + str(orderId)
8989
            else:
9000
            else:
8990
                raise TransactionServiceException(303, "Invalid jacket number")
9001
                raise TransactionServiceException(303, "Invalid jacket number")
Line 9072... Line 9083...
9072
                if order.productCondition != ProductCondition.BAD:
9083
                if order.productCondition != ProductCondition.BAD:
9073
                    item_pricing = inventory_client.getItemPricing(item_id, warehouse.vendor.id)
9084
                    item_pricing = inventory_client.getItemPricing(item_id, warehouse.vendor.id)
9074
                    lineitem.transfer_price = item_pricing.transferPrice
9085
                    lineitem.transfer_price = item_pricing.transferPrice
9075
                    lineitem.nlc = item_pricing.nlc
9086
                    lineitem.nlc = item_pricing.nlc
9076
                #Now onwards vatRates are obsolete, we will be using fields igst, sgst and cgst
9087
                #Now onwards vatRates are obsolete, we will be using fields igst, sgst and cgst
9077
                if not catalog_client.isAlive():
9088
                    gstRates = gstRatesMap.get(lineitem.hsnCode)
9078
                    catalog_client = CatalogClient().get_client()
9089
                    lineitem.igstRate = gstRates.igstRate
9079
                if order.taxType == TaxType.IGST:
9090
                    lineitem.cgstRate = gstRates.cgstRate
9080
                    lineitem.igstRate =  catalog_client.getIgstRate(lineitem.hsnCode)
9091
                    lineitem.sgstRate = gstRates.sgstRate
9081
                elif order.taxType == TaxType.SGST:
9092
                    
9082
                    sgstRate = catalog_client.getSgstRates(lineitem.item_id, whStateId)
-
 
9083
                    
9093
                    
9084
                order.vendorId = warehouse.vendor.id
9094
                order.vendorId = warehouse.vendor.id
9085
            except InventoryServiceException as e:
9095
            except InventoryServiceException as e:
9086
                print sys.exc_info()[0]
9096
                print sys.exc_info()[0]
9087
                print e.message
9097
                print e.message