Subversion Repositories SmartDukaan

Rev

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

Rev 4843 Rev 4858
Line 996... Line 996...
996
    at the time of billing.
996
    at the time of billing.
997
    '''
997
    '''
998
    if(vendorId == -1):
998
    if(vendorId == -1):
999
        total = 0
999
        total = 0
1000
        try:
1000
        try:
-
 
1001
            if item.preferredWarehouse is not None:
-
 
1002
                warehouse = Warehouse.query.filter_by(id=item.preferredWarehouse).first()
-
 
1003
                vendors = warehouse.vendors
-
 
1004
                item_pricings = []
-
 
1005
                for vendor in vendors :
-
 
1006
                    item_pricing = VendorItemPricing.query.filter_by(item=item, vendor=vendor).first()
-
 
1007
                    if item_pricing :
-
 
1008
                        item_pricings.append(item_pricing)
-
 
1009
            else :
1001
            item_pricings = VendorItemPricing.query.filter_by(item=item).all()
1010
                item_pricings = VendorItemPricing.query.filter_by(item=item).all()
1002
            if item_pricings:
1011
            if item_pricings:
1003
                for item_pricing in item_pricings:
1012
                for item_pricing in item_pricings:
1004
                    total += item_pricing.transfer_price
1013
                    total += item_pricing.transfer_price
1005
                avg = total / len(item_pricings)
1014
                avg = total / len(item_pricings)
1006
                item_pricing.transfer_price = avg
1015
                item_pricing.transfer_price = avg