示例#1
0
文件: Test.py 项目: vvipi91/Sigb-Odoo
def update_task_flow():
    response = {}
    modelName = "stock.warehouse.logistic.task"
    if (request.data):
        data_list = json.loads(request.data)
        request_dict = data_list['params']
        update_id = request_dict['to_update_id']
        state = request_dict['update_data']
        print update_id
        api_class = Helpers(request_dict['url'], request_dict['db'],
                            int(request_dict['uid']), request_dict['password'])
        check_access = api_class.check_access_rights(modelName)
        if (check_access):
            if (state == 'confirmed'):
                updated_id = api_class.api_workflow(modelName, update_id)
                print("updated id is %s" % updated_id)
                response = {'status': 'success', 'msg': 'updated Successfully'}
            if (state == 'assigned'):
                updated_id = api_class.api_workflow_assign(
                    modelName, update_id)
                print("updated id is %s" % updated_id)
                response = {'status': 'success', 'msg': 'updated Successfully'}
            if (state == 'accepted'):
                updated_id = api_class.api_workflow_accept(
                    modelName, update_id)
                print("updated id is %s" % updated_id)
                response = {'status': 'success', 'msg': 'updated Successfully'}
            if (state == 'done'):
                updated_id = api_class.api_workflow_done(modelName, update_id)
                print("updated id is %s" % updated_id)
                response = {'status': 'success', 'msg': 'updated Successfully'}
            if (state == 'cancel'):
                updated_id = api_class.api_workflow_cancel(
                    modelName, update_id)
                print("updated id is %s" % updated_id)
                response = {'status': 'success', 'msg': 'updated Successfully'}
            if (state == 'rejected'):
                updated_id = api_class.api_workflow_reject(
                    modelName, update_id)
                print("updated id is %s" % updated_id)
                response = {'status': 'success', 'msg': 'updated Successfully'}
            if (state == 'failed'):
                updated_id = api_class.api_workflow_fail(modelName, update_id)
                print("updated id is %s" % updated_id)
                response = {'status': 'success', 'msg': 'updated Successfully'}
            if (state == 'draft'):
                updated_id = api_class.api_workflow_draft(modelName, update_id)
                print("updated id is %s" % updated_id)
                response = {'status': 'success', 'msg': 'updated Successfully'}
    return jsonify(response)
示例#2
0
def update_task_flow_accept():
    modelName = "stock.warehouse.logistic.task"
    if(request.data):
        data_list = json.loads(request.data)
        request_dict = data_list['params']
        update_id = request_dict['to_update_id']
        print update_id
        api_class=Helpers(request_dict['url'],request_dict['db'],int(request_dict['uid']),request_dict['password'])
        check_access = api_class.check_access_rights(modelName)
        if(check_access):
            updated_id=api_class.api_workflow_reject(modelName,update_id)
            print("updated id is %s"%updated_id)
            response={'status':'success','msg':'updated Successfully'}
    return jsonify(response)