| 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
|
18 |
OOSTracker,EntityTag, ItemInsurerMapping, Insurer
|
| 19 |
from shop2020.thriftpy.model.v1.catalog.ttypes import status, ItemShippingInfo, \
|
19 |
from shop2020.thriftpy.model.v1.catalog.ttypes import status, ItemShippingInfo, \
|
| 20 |
ItemType
|
20 |
ItemType, PremiumType
|
| 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 1316... |
Line 1316... |
| 1316 |
return True
|
1316 |
return True
|
| 1317 |
|
1317 |
|
| 1318 |
def delete_entity_tag(displayName, catalogId):
|
1318 |
def delete_entity_tag(displayName, catalogId):
|
| 1319 |
session.query(EntityTag.tag).filter_by(tag=displayName,entityId=catalogId).delete()
|
1319 |
session.query(EntityTag.tag).filter_by(tag=displayName,entityId=catalogId).delete()
|
| 1320 |
session.commit()
|
1320 |
session.commit()
|
| 1321 |
return True
|
- |
|
| 1322 |
|
1321 |
return True
|
| - |
|
1322 |
|
| - |
|
1323 |
def get_insurance_amount(itemId, insurerId, quantity):
|
| - |
|
1324 |
itemInsurerMapping = ItemInsurerMapping.query.filter(ItemInsurerMapping.itemId == itemId).filter(ItemInsurerMapping.insurerId == insurerId).first()
|
| - |
|
1325 |
if not itemInsurerMapping:
|
| - |
|
1326 |
return 0
|
| - |
|
1327 |
insuranceAmount = 0.0
|
| - |
|
1328 |
if itemInsurerMapping.premiumType == PremiumType._NAMES_TO_VALUES.get("PERCENT"):
|
| - |
|
1329 |
item = Item.get_by(id = itemId)
|
| - |
|
1330 |
insuranceAmount = item.sellingPrice * (itemInsurerMapping.premiumAmount/100) * quantity
|
| - |
|
1331 |
else :
|
| - |
|
1332 |
insuranceAmount = itemInsurerMapping.premiumAmount * quantity
|
| - |
|
1333 |
|
| - |
|
1334 |
return insuranceAmount
|
| - |
|
1335 |
|
| - |
|
1336 |
def get_insurer(insurerId):
|
| - |
|
1337 |
return Insurer.get_by(id = insurerId)
|
| - |
|
1338 |
|
| 1323 |
|
1339 |
|