示例#1
0
def get_product_template_by_id(*args, **kwargs):
    product_id = kwargs["product_id"]
    query_params = dict(id=product_id, )
    xmlrpcclient = xmlrpc_client.get_xmlrpcclient("Product")
    if utils.has_obj(xmlrpcclient, query_params):
        [product_obj] = utils.read_obj(xmlrpcclient, query_params)
        product_tmpl_id = tuple(product_obj["product_tmpl_id"])[0]
    else:
        return None
    query_params = dict(id=product_tmpl_id, )
    xmlrpcclient = xmlrpc_client.get_xmlrpcclient("ProductTemplate")
    if utils.has_obj(xmlrpcclient, query_params):
        product_template_obj = utils.read_obj(xmlrpcclient, query_params)
    else:
        return None
    return product_template_obj[0]
示例#2
0
def get_purchase_order_line_list(order_id):
    query_params = dict(order_id=order_id, )
    xmlrpcclient = xmlrpc_client.get_xmlrpcclient("PurchaseOrderLine")
    if utils.has_obj(xmlrpcclient, query_params):
        purhase_order_line_list = utils.read_obj(xmlrpcclient, query_params)
        return purhase_order_line_list
    else:
        return []
示例#3
0
def get_purchase_order_line_list(order_id):
    query_params = dict(
        order_id = order_id,
    )
    xmlrpcclient = xmlrpc_client.get_xmlrpcclient("PurchaseOrderLine")
    if utils.has_obj(xmlrpcclient,query_params):
        purhase_order_line_list = utils.read_obj(xmlrpcclient,query_params)
        return purhase_order_line_list
    else : 
        return []
示例#4
0
def get_product_template_by_id(*args,**kwargs):
    product_id = kwargs["product_id"]
    query_params = dict(
        id = product_id,
    )
    xmlrpcclient = xmlrpc_client.get_xmlrpcclient("Product")
    if utils.has_obj(xmlrpcclient,query_params):
        [product_obj] = utils.read_obj(xmlrpcclient,query_params)
        product_tmpl_id = tuple(product_obj["product_tmpl_id"])[0]
    else :
        return None
    query_params = dict(
        id = product_tmpl_id,
    )
    xmlrpcclient = xmlrpc_client.get_xmlrpcclient("ProductTemplate")
    if utils.has_obj(xmlrpcclient,query_params):
        product_template_obj = utils.read_obj(xmlrpcclient,query_params)
    else :
        return None
    return product_template_obj[0]
示例#5
0
def get_shippping_data(*args,**options):
    start_time, end_time = utils.get_report_time(delta=options.get("delta", 0))
    extra_query_params = dict(
        start_time=("create_date", ">=", start_time),
        end_time=("create_date", "<=", end_time),
    )
    query_params = dict()
    xmlrpcclient = xmlrpc_client.get_xmlrpcclient("DhuiShipping")
    shipping_list = utils.read_obj(xmlrpcclient, query_params, extra_query_params)
    print shipping_list
    return shipping_list
示例#6
0
def get_product_template(*args,**kwargs):
    sku = kwargs["sku"]
    query_params = dict(
        sku = sku,
        categ_id=settings.PRODUCT_CATEGRAY_ID,
    )
    xmlrpcclient = xmlrpc_client.get_xmlrpcclient("ProductTemplate")
    if utils.has_obj(xmlrpcclient, query_params):
        result = utils.read_obj(xmlrpcclient,query_params)
    else:
        good = None
    return result[0]
示例#7
0
def get_shippping_data(*args, **options):
    start_time, end_time = utils.get_report_time(delta=options.get("delta", 0))
    extra_query_params = dict(
        start_time=("create_date", ">=", start_time),
        end_time=("create_date", "<=", end_time),
    )
    query_params = dict()
    xmlrpcclient = xmlrpc_client.get_xmlrpcclient("DhuiShipping")
    shipping_list = utils.read_obj(xmlrpcclient, query_params,
                                   extra_query_params)
    print shipping_list
    return shipping_list
示例#8
0
def get_product_template(*args, **kwargs):
    sku = kwargs["sku"]
    query_params = dict(
        sku=sku,
        categ_id=settings.PRODUCT_CATEGRAY_ID,
    )
    xmlrpcclient = xmlrpc_client.get_xmlrpcclient("ProductTemplate")
    if utils.has_obj(xmlrpcclient, query_params):
        result = utils.read_obj(xmlrpcclient, query_params)
    else:
        good = None
    return result[0]
示例#9
0
def get_purchase_order_list(*args, **kwargs):
    start_time, end_time = utils.get_report_time(delta=kwargs.get("delta", 0))
    extra_query_params = dict(
        start_time=("create_date", ">=", start_time),
        end_time=("create_date", "<=", end_time),
    )
    query_params = dict(partner_id=settings.DHUI_PARTNER_ID, )
    xmlrpcclient = xmlrpc_client.get_xmlrpcclient("PurchaseOrder")
    purchase_order_list = utils.read_obj(xmlrpcclient, query_params,
                                         extra_query_params)
    print purchase_order_list
    return purchase_order_list
示例#10
0
文件: dhui_order.py 项目: niyoufa/ods
def get_purchase_order_list(*args,**kwargs):
    start_time, end_time = utils.get_report_time(delta=kwargs.get("delta",0))
    extra_query_params = dict(
        start_time=("create_date",">=", start_time),
        end_time=("create_date","<=", end_time),
    )
    query_params = dict(
        partner_id=settings.DHUI_PARTNER_ID,
    )
    xmlrpcclient = xmlrpc_client.get_xmlrpcclient("PurchaseOrder")
    purchase_order_list = utils.read_obj(xmlrpcclient, query_params, extra_query_params)
    print purchase_order_list
    return purchase_order_list
示例#11
0
文件: dhui_order.py 项目: niyoufa/ods
def get_sale_order_list(*args,**kwargs):
    start_time , end_time = utils.get_report_time(datetime.datetime.now(),delta=kwargs.get("delta",0))
    extra_query_params = dict(
        start_time = ("order_purchase_time",">=",start_time),
        end_tme = ("order_purchase_time","<=",end_time),
        state=("state", "=", "manual"),
    )
    query_params = dict(
        partner_id=settings.COMMON_CUSTOMER_ID,
        user_id=settings.DHUI_MANAGER_USER_ID,
    )
    xmlrpcclient = xmlrpc_client.get_xmlrpcclient("SaleOrder")
    sale_order_list = utils.read_obj(xmlrpcclient,query_params,extra_query_params)
    # print sale_order_list
    return sale_order_list
示例#12
0
def get_sale_order_list(*args, **kwargs):
    start_time, end_time = utils.get_report_time(datetime.datetime.now(),
                                                 delta=kwargs.get("delta", 0))
    extra_query_params = dict(
        start_time=("order_purchase_time", ">=", start_time),
        end_tme=("order_purchase_time", "<=", end_time),
        state=("state", "=", "manual"),
    )
    query_params = dict(
        partner_id=settings.COMMON_CUSTOMER_ID,
        user_id=settings.DHUI_MANAGER_USER_ID,
    )
    xmlrpcclient = xmlrpc_client.get_xmlrpcclient("SaleOrder")
    sale_order_list = utils.read_obj(xmlrpcclient, query_params,
                                     extra_query_params)
    # print sale_order_list
    return sale_order_list
示例#13
0
文件: dhui_task.py 项目: niyoufa/ods
def get_task_list(*args,**options):
    user_id = options.get("user_id",None)
    if user_id == None :
        return []
    xmlrpcclient = xmlrpc_client.get_xmlrpcclient("ResUsers")
    query_params = dict(
        user_id = user_id,
    )
    if utils.has_obj(xmlrpcclient,query_params):
        [uid] = xmlrpcclient.search(query_params)
    else:
        return []

    xmlrpcclient = xmlrpc_client.get_xmlrpcclient("DhuiTask")
    task_id_list = []

    query_params = dict(
        create_uid = uid,
    )
    create_id_task_list = xmlrpcclient.search(query_params)

    query_params = dict(
        user_id = uid,
    )
    part_id_task_list = xmlrpcclient.search(query_params)

    query_params = dict(
        reviewer_id = uid,
    )
    review_id_task_list = xmlrpcclient.search(query_params)

    task_id_list.extend(create_id_task_list)
    task_id_list.extend(part_id_task_list)
    task_id_list.extend(review_id_task_list)
    task_id_list = list(set(task_id_list))

    query_params = dict(
        id_list = task_id_list,
        field_list = ["id","create_date","date_end","create_uid","user_id",
                      "data_start","progress","project_id","description",
                      "active","name","date_deadline","reviewer_id",
                      "total_hours","remaining_hours","group_type"]
    )
    task_list = utils.read_obj(xmlrpcclient,query_params)
    return task_list
示例#14
0
def get_good_invoice_data(*args,**options):
    start_time, end_time = utils.get_report_time(delta=options.get("delta", 0))

    invoice_xmlrpcclient = xmlrpc_client.get_xmlrpcclient("DhuiInvoice")
    extra_query_params = dict(
        start_time=("create_time", ">=", start_time),
        end_tme=("create_time", "<=", end_time),
    )
    query_params = {}
    good_invoice_list = utils.read_obj(invoice_xmlrpcclient, query_params, extra_query_params)

    good_invoice_data = []
    for good_invoice in good_invoice_list :
        good_invoice_data.append(dict(
            _id=good_invoice["_id"],
            create_time=good_invoice["create_time"],
            partner_id=good_invoice["partner_id"][1],
            deliver_status=u'未发货' if good_invoice["deliver_status"] == False else u'已发货'
        ))
    return good_invoice_data
示例#15
0
def get_good_invoice_data(*args, **options):
    start_time, end_time = utils.get_report_time(delta=options.get("delta", 0))

    invoice_xmlrpcclient = xmlrpc_client.get_xmlrpcclient("DhuiInvoice")
    extra_query_params = dict(
        start_time=("create_time", ">=", start_time),
        end_tme=("create_time", "<=", end_time),
    )
    query_params = {}
    good_invoice_list = utils.read_obj(invoice_xmlrpcclient, query_params,
                                       extra_query_params)

    good_invoice_data = []
    for good_invoice in good_invoice_list:
        good_invoice_data.append(
            dict(_id=good_invoice["_id"],
                 create_time=good_invoice["create_time"],
                 partner_id=good_invoice["partner_id"][1],
                 deliver_status=u'未发货'
                 if good_invoice["deliver_status"] == False else u'已发货'))
    return good_invoice_data
示例#16
0
def get_task_list(*args, **options):
    user_id = options.get("user_id", None)
    if user_id == None:
        return []
    xmlrpcclient = xmlrpc_client.get_xmlrpcclient("ResUsers")
    query_params = dict(user_id=user_id, )
    if utils.has_obj(xmlrpcclient, query_params):
        [uid] = xmlrpcclient.search(query_params)
    else:
        return []

    xmlrpcclient = xmlrpc_client.get_xmlrpcclient("DhuiTask")
    task_id_list = []

    query_params = dict(create_uid=uid, )
    create_id_task_list = xmlrpcclient.search(query_params)

    query_params = dict(user_id=uid, )
    part_id_task_list = xmlrpcclient.search(query_params)

    query_params = dict(reviewer_id=uid, )
    review_id_task_list = xmlrpcclient.search(query_params)

    task_id_list.extend(create_id_task_list)
    task_id_list.extend(part_id_task_list)
    task_id_list.extend(review_id_task_list)
    task_id_list = list(set(task_id_list))

    query_params = dict(id_list=task_id_list,
                        field_list=[
                            "id", "create_date", "date_end", "create_uid",
                            "user_id", "data_start", "progress", "project_id",
                            "description", "active", "name", "date_deadline",
                            "reviewer_id", "total_hours", "remaining_hours",
                            "group_type"
                        ])
    task_list = utils.read_obj(xmlrpcclient, query_params)
    return task_list