huangweiboy / odoo-client-JSON-RPC

JSON-RPC Client for ODOO OpenERP

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

odoo JSON-RPC Client using NODE js

Join the chat at https://gitter.im/GauravSahu/odoo-client-JSON-RPC 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/).

Instructions

===================
node app.js

Client JSON

localhost:3000/odoo-client
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 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" : "search",
  		"args" : [1,20],  // range of id 
  		"filter" : "",//[["name","=","Gaurav"]]
  		"fields" : "",
  		"domain" : "",
  		"offset" : "",
  		"limit" : "",
  		"sort" : "",
  		"resource_id":""
  	}
}

About

JSON-RPC Client for ODOO OpenERP


Languages

Language:JavaScript 100.0%