Subversion Repositories SmartDukaan

Rev

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

Rev 7368 Rev 7382
Line 255... Line 255...
255
 
255
 
256
    ds_item.isWarehousePreferenceSticky = item.isWarehousePreferenceSticky
256
    ds_item.isWarehousePreferenceSticky = item.isWarehousePreferenceSticky
257
    
257
    
258
    ds_item.updatedOn = datetime.datetime.now()
258
    ds_item.updatedOn = datetime.datetime.now()
259
    
259
    
-
 
260
 
-
 
261
    if item.category not in [10001, 10002, 10003, 10004, 10005, 10009, 10010]:
260
#    if item.activeOnStore and  not ds_item.activeOnStore:
262
        ds_item.activeOnStore = True
261
#        add_store_pricing(ds_item)
263
        update_store_pricing(get_store_pricing(item.id))
-
 
264
    else:
262
    ds_item.activeOnStore = item.activeOnStore
265
        ds_item.activeOnStore = item.activeOnStore
263
    
266
    
264
    session.commit();
267
    session.commit();
265
    subject = "Item '{0}' is updated in Catalog. Id is {1}".format(__get_product_name(ds_item),ds_item.id)
268
    subject = "Item '{0}' is updated in Catalog. Id is {1}".format(__get_product_name(ds_item),ds_item.id)
266
    if message:
269
    if message:
267
        __send_mail(subject, message)
270
        __send_mail(subject, message)
Line 1480... Line 1483...
1480
    brandInfoList = FreebieItem.query.all()
1483
    brandInfoList = FreebieItem.query.all()
1481
    for brandInfo in brandInfoList:
1484
    for brandInfo in brandInfoList:
1482
        brandInfoMap[brandInfo.name] = to_t_brand_info(brandInfo)
1485
        brandInfoMap[brandInfo.name] = to_t_brand_info(brandInfo)
1483
    return brandInfoMap
1486
    return brandInfoMap
1484
 
1487
 
1485
def update_store_pricing(tsp):
1488
def update_store_pricing(tsp, allColors):
1486
    validate_store_pricing(tsp)
1489
    validate_store_pricing(tsp)
-
 
1490
    item = get_item(tsp.itemId)
-
 
1491
    if allColors:
-
 
1492
        items = get_items_by_catalog_id(item.catalog_item_id)
-
 
1493
    else:
-
 
1494
        items = [item]
-
 
1495
    for item in items:
1487
    sp = StorePricing.get_by(item_id = tsp.itemId)
1496
        sp = StorePricing.get_by(item_id = item.id)
1488
    if not sp:
1497
        if not sp:
1489
        sp = StorePricing()
1498
            sp = StorePricing()
1490
    sp.recommendedPrice = tsp.recommendedPrice
1499
        sp.recommendedPrice = tsp.recommendedPrice
1491
    sp.minPrice = tsp.minPrice
1500
        sp.minPrice = tsp.minPrice
1492
    sp.minAdvancePrice = tsp.minAdvancePrice
1501
        sp.minAdvancePrice = tsp.minAdvancePrice
1493
    sp.maxPrice = tsp.maxPrice
1502
        sp.maxPrice = tsp.maxPrice
1494
    sp.item_id = tsp.itemId
1503
        sp.item_id = item.id
1495
    sp.freebieItemId = tsp.freebieItemId
1504
        sp.freebieItemId = tsp.freebieItemId
1496
    sp.bestDealText = tsp.bestDealText
1505
        sp.bestDealText = tsp.bestDealText
1497
    sp.absoluteMinPrice = tsp.absoluteMinPrice
1506
        sp.absoluteMinPrice = tsp.absoluteMinPrice
1498
    session.commit()
1507
    session.commit()
1499
    
1508
    
1500
    
1509
    
1501
def validate_store_pricing(tsp):
1510
def validate_store_pricing(tsp):
1502
    if tsp.minPrice > tsp.maxPrice:
1511
    if tsp.minPrice > tsp.maxPrice:
Line 1520... Line 1529...
1520
 
1529
 
1521
def get_defalut_store_pricing(itemId):
1530
def get_defalut_store_pricing(itemId):
1522
    inventoryClient = InventoryClient().get_client()
1531
    inventoryClient = InventoryClient().get_client()
1523
    pricings = inventoryClient.getAllItemPricing(itemId)
1532
    pricings = inventoryClient.getAllItemPricing(itemId)
1524
    item = get_item(itemId)
1533
    item = get_item(itemId)
-
 
1534
    maxp = item.sellingPrice
-
 
1535
    if item.mrp:
1525
    maxp = item.mrp
1536
        maxp = item.mrp
-
 
1537
            
1526
    minp = 0
1538
    minp = 0
1527
    rp = item.sellingPrice
1539
    rp = item.sellingPrice
1528
    for pricing in pricings:
1540
    for pricing in pricings:
1529
        if not minp or minp > pricing.dealerPrice: 
1541
        if not minp or minp > pricing.dealerPrice: 
1530
            minp = pricing.dealerPrice
1542
            minp = pricing.dealerPrice