Subversion Repositories SmartDukaan

Rev

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

Rev 22120 Rev 22123
Line 43... Line 43...
43
    
43
    
44
 
44
 
45
def addHsnCodes():
45
def addHsnCodes():
46
    gstTuple = [
46
    gstTuple = [
47
                (10027, 'Power Bank', '85076000', 28),
47
                (10027, 'Power Bank', '85076000', 28),
48
                (10030, 'Cables', '85183000', 28),
48
                (10030, 'USB Cables', '85444220', 28),
49
                (10024, 'Ear Buds', '85444220', 18),
49
                (10024, 'Ear Buds', '85183000', 18),
50
                (12101, 'Fitness Band', '90318000', 18)
50
                (12101, 'Fitness Band', '90318000', 18)
51
            ]
51
            ]
52
    
52
    
53
    
53
    
54
    
54
    
55
    for (categoryId, description, hsnCode, rate)  in gstTuple:
55
    for (categoryId, description, hsnCode, rate)  in gstTuple:
56
        categoryHsnCode = session.query(CategoryHsnCodes).filter(CategoryHsnCodes.hsnCode==hsnCode).first()
56
        categoryHsnCode = session.query(CategoryHsnCodes).filter(CategoryHsnCodes.hsnCode==hsnCode).filter(CategoryHsnCodes.categoryId==categoryId).first()
57
        if categoryHsnCode:
57
        if categoryHsnCode:
58
            categoryHsnCode.categoryId = categoryId
58
            if categoryHsnCode.description !=description:
59
            categoryHsnCode.description = description
59
                categoryHsnCode.description = description
60
        else:
60
        else:
61
            categoryHsnCode = CategoryHsnCodes()
61
            categoryHsnCode = CategoryHsnCodes()
62
            categoryHsnCode.hsnCode = hsnCode
62
            categoryHsnCode.hsnCode = hsnCode
63
            categoryHsnCode.categoryId = categoryId
63
            categoryHsnCode.categoryId = categoryId
64
            categoryHsnCode.description = description
64
            categoryHsnCode.description = description