Subversion Repositories SmartDukaan

Rev

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

Rev 4539 Rev 4543
Line 971... Line 971...
971
    if vendor id is -1 then we calculate an average transfer price to be populated
971
    if vendor id is -1 then we calculate an average transfer price to be populated
972
    at the time of order creation. This will be later updated with actual transfer price
972
    at the time of order creation. This will be later updated with actual transfer price
973
    at the time of billing.
973
    at the time of billing.
974
    '''
974
    '''
975
    if(vendorId == -1):
975
    if(vendorId == -1):
-
 
976
        total = 0
976
        try:
977
        try:
977
            item_pricings = VendorItemPricing.query.filter_by(item=item).all()
978
            item_pricings = VendorItemPricing.query.filter_by(item=item).all()
978
            if item_pricings:
979
            if item_pricings:
979
                for item_pricing in item_pricings:
980
                for item_pricing in item_pricings:
980
                    total =+ item_pricing.transfer_price
981
                    total += item_pricing.transfer_price
981
                avg = total / len(item_pricings)
982
                avg = total / len(item_pricings)
982
                item_pricing.transfer_price = avg
983
                item_pricing.transfer_price = avg
-
 
984
            else:
-
 
985
                item_pricing = VendorItemPricing()
-
 
986
                item_pricing.transfer_price = item.sellingPrice
-
 
987
                vendor = Vendor()
-
 
988
                vendor.id = vendorId
-
 
989
                item_pricing.vendor = vendor
-
 
990
                item_pricing.item = item
-
 
991
                
983
                return item_pricing
992
            return item_pricing
984
        except:
993
        except:
985
            raise InventoryServiceException(101, "Item pricing not found ")
994
            raise InventoryServiceException(101, "Item pricing not found ")
986
    vendor = Vendor.get_by(id=vendorId)    
995
    vendor = Vendor.get_by(id=vendorId)    
987
    try:
996
    try:
988
        item_pricing = VendorItemPricing.query.filter_by(vendor=vendor, item=item).one()
997
        item_pricing = VendorItemPricing.query.filter_by(vendor=vendor, item=item).one()