Subversion Repositories SmartDukaan

Rev

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

Rev 4543 Rev 4649
Line 6... Line 6...
6
from elixir import *
6
from elixir import *
7
from shop2020.model.v1.catalog.impl import DataService
7
from shop2020.model.v1.catalog.impl import DataService
8
from shop2020.model.v1.catalog.impl.DataService import Item, \
8
from shop2020.model.v1.catalog.impl.DataService import Item, \
9
    Warehouse, ItemInventoryHistory, CurrentInventorySnapshot, ItemInfo,\
9
    Warehouse, ItemInventoryHistory, CurrentInventorySnapshot, ItemInfo,\
10
    ItemChangeLog, Category, EntityIDGenerator, VendorItemPricing,\
10
    ItemChangeLog, Category, EntityIDGenerator, VendorItemPricing,\
11
    VendorItemMapping, Vendor, SimilarItems, ProductNotification, Source, SourceItemPricing
11
    VendorItemMapping, Vendor, SimilarItems, ProductNotification, Source, SourceItemPricing, AuthorizationLog
12
from shop2020.thriftpy.model.v1.catalog.ttypes import \
12
from shop2020.thriftpy.model.v1.catalog.ttypes import \
13
    InventoryServiceException, status, ItemShippingInfo
13
    InventoryServiceException, status, ItemShippingInfo
14
from shop2020.model.v1.catalog.impl.Convertors import to_t_item,\
14
from shop2020.model.v1.catalog.impl.Convertors import to_t_item,\
15
    to_t_vendor_item_pricing, to_t_source
15
    to_t_vendor_item_pricing, to_t_source
16
import datetime
16
import datetime
Line 1499... Line 1499...
1499
def get_warehouses_for_vendor(vendorId):
1499
def get_warehouses_for_vendor(vendorId):
1500
    try:
1500
    try:
1501
        vendor = get_Vendor(vendorId)
1501
        vendor = get_Vendor(vendorId)
1502
        return vendor.warehouses
1502
        return vendor.warehouses
1503
    except:
1503
    except:
1504
        raise InventoryServiceException(108, "Bad Vendor Id")
-
 
1505
1504
        raise InventoryServiceException(108, "Bad Vendor Id")
-
 
1505
 
-
 
1506
def add_authorization_log_for_item(itemId, username, reason):
-
 
1507
    if not itemId or not username:
-
 
1508
        raise InventoryServiceException(101, "Bad itemId or Invalid username in request")
-
 
1509
    authorize_log = AuthorizationLog()
-
 
1510
    authorize_log.item_id = itemId
-
 
1511
    authorize_log.username = username
-
 
1512
    authorize_log.reason = reason
-
 
1513
    session.commit()
-
 
1514
    return True
-
 
1515
1506
1516