Subversion Repositories SmartDukaan

Rev

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

Rev 5133 Rev 5147
Line 801... Line 801...
801
        [warehouse_retid, total_availability] = __get_warehouse_with_max_availability(goodBillableWarehousesAtPreferredShippingLocation, item)
801
        [warehouse_retid, total_availability] = __get_warehouse_with_max_availability(goodBillableWarehousesAtPreferredShippingLocation, item)
802
        if warehouse_retid == -1:
802
        if warehouse_retid == -1:
803
            [warehouse_retid, total_availability] = __get_warehouse_with_max_availability(nonBillableWarehousesCorrespondingToPreferredShippingLocation, item)
803
            [warehouse_retid, total_availability] = __get_warehouse_with_max_availability(nonBillableWarehousesCorrespondingToPreferredShippingLocation, item)
804
            if warehouse_retid == -1:
804
            if warehouse_retid == -1:
805
                warehouse_retid = goodBillableWarehousesAtPreferredShippingLocation[0]
805
                warehouse_retid = goodBillableWarehousesAtPreferredShippingLocation[0]
-
 
806
                if item.preferredVendor:
-
 
807
                    warehousesWithPreferredVendorAtPreferredShippingLocation = Warehouse.query.filter_by(shippingWarehouseId = item.preferredWarehouse, inventoryType = InventoryType._VALUES_TO_NAMES[InventoryType.GOOD], vendor_id = item.preferredVendor).all()
-
 
808
                    if warehousesWithPreferredVendorAtPreferredShippingLocation:
-
 
809
                        warehouse_retid = warehousesWithPreferredVendorAtPreferredShippingLocation[0].id
806
    elif (not item.isWarehousePreferenceSticky and item.preferredWarehouse):
810
    elif (not item.isWarehousePreferenceSticky and item.preferredWarehouse):
807
        [warehouse_retid, total_availability] = __get_warehouse_with_max_availability(goodBillableWarehousesAtPreferredShippingLocation, item)
811
        [warehouse_retid, total_availability] = __get_warehouse_with_max_availability(goodBillableWarehousesAtPreferredShippingLocation, item)
808
 
812
 
809
    if warehouse_retid == -1:
813
    if warehouse_retid == -1:
810
        [warehouse_retid, total_availability] = __get_warehouse_with_max_availability(warehouse_ids, item)
814
        [warehouse_retid, total_availability] = __get_warehouse_with_max_availability(warehouse_ids, item)
811
        if warehouse_retid == -1:
815
        if warehouse_retid == -1:
812
            warehouse_retid = goodBillableWarehousesAtDefaultShippingLocation[0]
816
            warehouse_retid = goodBillableWarehousesAtDefaultShippingLocation[0]
-
 
817
            if item.preferredVendor:
-
 
818
                warehousesWithPreferredVendorAtDefaultShippingLocation = Warehouse.query.filter_by(shippingWarehouseId = item.defaultWarehouse, inventoryType = InventoryType._VALUES_TO_NAMES[InventoryType.GOOD], vendor_id = item.preferredVendor).all()
-
 
819
                if warehousesWithPreferredVendorAtDefaultShippingLocation:
-
 
820
                    warehouse_retid = warehousesWithPreferredVendorAtDefaultShippingLocation[0].id
813
        else:
821
        else:
814
            [warehouse_retid, total_availability] = __get_warehouse_with_max_availability(goodBillableWarehouses, item)
822
            [warehouse_retid, total_availability] = __get_warehouse_with_max_availability(goodBillableWarehouses, item)
815
            if warehouse_retid == -1:
823
            if warehouse_retid == -1:
816
                if item.preferredWarehouse:
824
                if item.preferredWarehouse:
817
                    [warehouse_retid, total_availability] = __get_warehouse_with_max_availability(nonBillableWarehousesCorrespondingToPreferredShippingLocation, item)
825
                    [warehouse_retid, total_availability] = __get_warehouse_with_max_availability(nonBillableWarehousesCorrespondingToPreferredShippingLocation, item)