Odoo-client-json-rpc

An JSON-RPC call is conducted between two parties: the client (the calling process) and the server (the called process).


Project maintained by GauravSahu Hosted on GitHub Pages — Theme by mattgraham

Odoo Client jsonRPC

JSON-RPC is known as a web service. Web services are a set of tools that let one build distributed applications on top of existing web infrastructures. These applications use the Web as a kind of "transport layer" but don't offer a direct human interface via the browser. An JSON-RPC call is conducted between two parties: the client (the calling process) and the server (the called process). A server is made available at a particular URL (such as http://example.org:8080/rpcserv/).

How to Use

node app.js

Now open your browser and type localhost:3000/odoo-client?

Client Request

To Create a New Record

client_req = {
    "opts" : {
        "login" : "admin",
            "password" : "123",
            "db" : "test",
            "host": "localhost",
            "port": "8069"
    },
    "moduleDetail" : {
        "model" : "hr.employee",
        "method" : "create",
        "args" : {
            "name" : "Gaurav"
        },
        "filter" : "",
        "fields" : "",
        "domain" : "",
        "offset" : "",
        "limit" : "",
        "sort" : "",
        "resource_id":""
    }
}

To Update a Record

client_req = {
    "opts" : {
        "login" : "admin",
            "password" : "123",
            "db" : "test",
            "host": "localhost",
            "port": "8069"
    },
    "moduleDetail" : {
        "model" : "hr.employee",
        "method" : "write",
        "args" : [1,{          // Here 1 is id of record
            "name" : "Gaurav"
        }],
        "filter" : "",
        "fields" : "",
        "domain" : "",
        "offset" : "",
        "limit" : "",
        "sort" : "",
        "resource_id":""
    }
}

To Delete a Record

client_req = {
    "opts" : {
        "login" : "admin",
            "password" : "123",
            "db" : "test",
            "host": "localhost",
            "port": "8069"
    },
    "moduleDetail" : {
        "model" : "hr.employee",
        "method" : "unlink",
        "args" : [1],  // id of record
        "filter" : "",
        "fields" : "",
        "domain" : "",
        "offset" : "",
        "limit" : "",
        "sort" : "",
        "resource_id":""
    }
}

To Read a Specific Record

client_req = {
    "opts" : {
        "login" : "admin",
            "password" : "123",
            "db" : "test",
            "host": "localhost",
            "port": "8069"
    },
    "moduleDetail" : {
        "model" : "hr.employee",
        "method" : "read",
        "args" : [1],  // id of record
        "filter" : "",
        "fields" : "",
        "domain" : "",
        "offset" : "",
        "limit" : "",
        "sort" : "",
        "resource_id":""
    }
}


To Search a Record

client_req = {
    "opts" : {
        "login" : "admin",
            "password" : "123",
            "db" : "test",
            "host": "localhost",
            "port": "8069"
    },
    "moduleDetail" : {
        "model" : "hr.employee",
        "method" : "read",
        "args" : [1],  // id of record
        "filter" : "",
        "fields" : "",
        "domain" : "",
        "offset" : "",
        "limit" : "",
        "sort" : "",
        "resource_id":""
    }
}


Author

Gaurav Sahu