Esempio n. 1
0
def get_products_in_provpipeline_list_new():
    """Returns a list of all products pending in provpipeline
    """
    k = Kerneladapter()
    pipeline = k.provpipeline_list_new()
    products = {}
    for kb in pipeline:
        for orderline in kb['orderlines']:
            products[orderline['product']] = products.get(orderline['product'], 0) + 1

    return products
Esempio n. 2
0
def get_ls_positions(date_to=None):
    """Returns the number of delivery-note-positions in kernele, that is new in the processing pipeline.
       When a date is given as parameter, all positions to deliver before and on that date are returned.
    """
    k = Kerneladapter()
    pipeline = k.provpipeline_list_new()
    ls_positions = 0
    for kb in pipeline:
        if not date_to or kb['versandtermin'] <= date_to:
            ls_positions += len(kb['orderlines'])
    return ls_positions
Esempio n. 3
0
def get_kbs_for_articles_in_pipeline(artnr):
    """Returns the KB-Numbers and the quantities (as a tupel) of the KBs in the Provisioning-Pipeline 
       that contain the given article-number
    """
    k = Kerneladapter()
    pipeline = k.provpipeline_list_new()
    kbs = []
    for kb in pipeline:
        for orderline in kb['orderlines']:
            if orderline['product'] == artnr:
                kbs.append((kb['id'], orderline['quantity']))
    return kbs
Esempio n. 4
0
def get_products_to_ship_today():
    """
    Create a dictionary with article numbers as keys and quantities as values
    of products that have to be shipped today
    (taken from pending orders in provpipeline)
    """

    products = {}
    kernel = Kerneladapter()
    for kommi in kernel.provpipeline_list_new():
        if kommi['shouldprocess'] == 'yes':
            for orderline in kommi['orderlines']:
                artnr = orderline['product']
                products[artnr] = products.get(artnr, 0) + orderline['quantity']
    return products