| Line 368... |
Line 368... |
| 368 |
|
368 |
|
| 369 |
def add_item(item):
|
369 |
def add_item(item):
|
| 370 |
if not item:
|
370 |
if not item:
|
| 371 |
raise InventoryServiceException(108, "Bad item in request")
|
371 |
raise InventoryServiceException(108, "Bad item in request")
|
| 372 |
if get_item(item.id):
|
372 |
if get_item(item.id):
|
| - |
|
373 |
print item.id
|
| 373 |
raise InventoryServiceException(101, "Item already exists")
|
374 |
raise InventoryServiceException(101, "Item already exists")
|
| 374 |
|
375 |
|
| 375 |
validate_item_prices(item)
|
376 |
validate_item_prices(item)
|
| 376 |
|
377 |
|
| 377 |
ds_item = Item()
|
378 |
ds_item = Item()
|
| Line 494... |
Line 495... |
| 494 |
ds_item.status_description = similar_item.status_description
|
495 |
ds_item.status_description = similar_item.status_description
|
| 495 |
|
496 |
|
| 496 |
session.commit();
|
497 |
session.commit();
|
| 497 |
subject = "New item is added. Id is {0}".format(str(ds_item.id))
|
498 |
subject = "New item is added. Id is {0}".format(str(ds_item.id))
|
| 498 |
message = "Category : {6}, Brand : {0}, Model : {1}, Model Number : {2}\nColor : {3}, Selling Price : {4}, Mrp : {5}, \nPromotion Text : {7}, Preferred Vendor: {8}".format(item.brand, item.modelNumber, item.modelName, item.color, item.sellingPrice, item.mrp, item.category, item.bestDealText,item.bestDealsDetailsText,item.bestDealsDetailsLink, preferredVendorName)
|
499 |
message = "Category : {6}, Brand : {0}, Model : {1}, Model Number : {2}\nColor : {3}, Selling Price : {4}, Mrp : {5}, \nPromotion Text : {7}, Preferred Vendor: {8}".format(item.brand, item.modelNumber, item.modelName, item.color, item.sellingPrice, item.mrp, item.category, item.bestDealText,item.bestDealsDetailsText,item.bestDealsDetailsLink, preferredVendorName)
|
| 499 |
__send_mail(subject, message)
|
500 |
#__send_mail(subject, message)
|
| 500 |
return ds_item.id
|
501 |
return ds_item.id
|
| 501 |
|
502 |
|
| 502 |
def retire_item(item_id):
|
503 |
def retire_item(item_id):
|
| 503 |
if not item_id:
|
504 |
if not item_id:
|
| 504 |
raise InventoryServiceException(101, "bad item id")
|
505 |
raise InventoryServiceException(101, "bad item id")
|
| Line 1461... |
Line 1462... |
| 1461 |
|
1462 |
|
| 1462 |
def __send_mail(subject, message, send_to = to_addresses):
|
1463 |
def __send_mail(subject, message, send_to = to_addresses):
|
| 1463 |
try:
|
1464 |
try:
|
| 1464 |
thread = threading.Thread(target=partial(mail, mail_user, mail_password, send_to, subject, message))
|
1465 |
thread = threading.Thread(target=partial(mail, mail_user, mail_password, send_to, subject, message))
|
| 1465 |
thread.start()
|
1466 |
thread.start()
|
| 1466 |
except Exception as ex:
|
1467 |
except Exception:
|
| 1467 |
print ex
|
1468 |
pass
|
| 1468 |
|
1469 |
|
| 1469 |
def get_vat_amount_for_item(itemId, price):
|
1470 |
def get_vat_amount_for_item(itemId, price):
|
| 1470 |
item = Item.query.filter_by(id=itemId).first()
|
1471 |
item = Item.query.filter_by(id=itemId).first()
|
| 1471 |
vatPercentage = item.vatPercentage
|
1472 |
vatPercentage = item.vatPercentage
|
| 1472 |
if vatPercentage is None:
|
1473 |
if vatPercentage is None:
|