Subversion Repositories SmartDukaan

Rev

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

Rev 7134 Rev 7190
Line 13... Line 13...
13
from shop2020.model.v1.catalog.impl.CategoryManager import CategoryManager
13
from shop2020.model.v1.catalog.impl.CategoryManager import CategoryManager
14
from shop2020.model.v1.catalog.impl.Convertors import to_t_item, to_t_source
14
from shop2020.model.v1.catalog.impl.Convertors import to_t_item, to_t_source
15
from shop2020.model.v1.catalog.impl.DataService import Item, ItemChangeLog, \
15
from shop2020.model.v1.catalog.impl.DataService import Item, ItemChangeLog, \
16
    Category, EntityIDGenerator, SimilarItems, ProductNotification, Source, \
16
    Category, EntityIDGenerator, SimilarItems, ProductNotification, Source, \
17
    SourceItemPricing, AuthorizationLog, VoucherItemMapping, CategoryVatMaster, \
17
    SourceItemPricing, AuthorizationLog, VoucherItemMapping, CategoryVatMaster, \
18
    OOSTracker,EntityTag,ItemInsurerMapping, Insurer, Banner, BannerMap
18
    OOSTracker,EntityTag,ItemInsurerMapping, Insurer, Banner, BannerMap, FreebieItem
19
from shop2020.thriftpy.model.v1.catalog.ttypes import status, ItemShippingInfo, \
19
from shop2020.thriftpy.model.v1.catalog.ttypes import status, ItemShippingInfo, \
20
    ItemType, PremiumType
20
    ItemType, PremiumType, FreebieItem as t_FreebieItem
21
from shop2020.thriftpy.model.v1.inventory.ttypes import \
21
from shop2020.thriftpy.model.v1.inventory.ttypes import \
22
    InventoryServiceException, IgnoredInventoryUpdateItems
22
    InventoryServiceException, IgnoredInventoryUpdateItems
23
from shop2020.utils import EmailAttachmentSender
23
from shop2020.utils import EmailAttachmentSender
24
from shop2020.utils.EmailAttachmentSender import mail
24
from shop2020.utils.EmailAttachmentSender import mail
25
from shop2020.utils.Utils import to_py_date, log_risky_flag
25
from shop2020.utils.Utils import to_py_date, log_risky_flag
Line 1441... Line 1441...
1441
    if insurer.declaredAmount > 0.9*insurer.creditedAmount:
1441
    if insurer.declaredAmount > 0.9*insurer.creditedAmount:
1442
        __send_mail("CRITICAL: Declared Insurance Amount is critical (Declared Amount - " + str(insurer.declaredAmount) + " and Credited Amount - " + str(insurer.creditedAmount) +")", "Please top up credited amount")    
1442
        __send_mail("CRITICAL: Declared Insurance Amount is critical (Declared Amount - " + str(insurer.declaredAmount) + " and Credited Amount - " + str(insurer.creditedAmount) +")", "Please top up credited amount")    
1443
    elif insurer.declaredAmount > 0.8*insurer.creditedAmount:
1443
    elif insurer.declaredAmount > 0.8*insurer.creditedAmount:
1444
        __send_mail("WARNING: Declared Insurance Amount is warning (Declared Amount - " + str(insurer.declaredAmount) + " and Credited Amount - " + str(insurer.creditedAmount) +")", "Please top up credited amount")    
1444
        __send_mail("WARNING: Declared Insurance Amount is warning (Declared Amount - " + str(insurer.declaredAmount) + " and Credited Amount - " + str(insurer.creditedAmount) +")", "Please top up credited amount")    
1445
        
1445
        
-
 
1446
def get_freebie_for_item(itemId):
-
 
1447
    freebie = FreebieItem.get_by(itemId = itemId)
-
 
1448
    if freebie is None:
-
 
1449
        return 0
-
 
1450
    else:
-
 
1451
        return freebie.freebieItemId
-
 
1452
    
-
 
1453
def add_or_update_freebie_for_item(freebieItem):
-
 
1454
    freebie = FreebieItem.get_by(itemId = freebieItem.itemId)
-
 
1455
    if freebie is None:
-
 
1456
        freebie = FreebieItem()
-
 
1457
        freebie.itemId = freebieItem.itemId
-
 
1458
    freebie.freebieItemId = freebieItem.freebieItemId
-
 
1459
    session.commit()
1446
1460