[FIX] web_api example, renamed from web_rpc
bzr revid: al@openerp.com-20120819010646-ujct3dwe9j0pmjq6
This commit is contained in:
parent
d43eb323f1
commit
7e7c583d24
|
@ -0,0 +1,13 @@
|
||||||
|
{
|
||||||
|
"name" : "OpenERP Web API",
|
||||||
|
"category" : "Hidden",
|
||||||
|
"description":"""Openerp Web API.""",
|
||||||
|
"version" : "2.0",
|
||||||
|
"depends" : ['web'],
|
||||||
|
"installable" : True,
|
||||||
|
'auto_install': False,
|
||||||
|
'js' : [
|
||||||
|
],
|
||||||
|
'css' : [
|
||||||
|
],
|
||||||
|
}
|
|
@ -0,0 +1,55 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html style="height: 100%">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
||||||
|
<style type="text/css">
|
||||||
|
body {
|
||||||
|
font-family: sans-serif;
|
||||||
|
}
|
||||||
|
pre.run {
|
||||||
|
border: 1px solid black; margin:0;padding:8px;
|
||||||
|
}
|
||||||
|
.result {
|
||||||
|
border: 1px solid black; margin:0;padding:8px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<title>OpenERP web_api example</title>
|
||||||
|
<script type="text/javascript" src="/web/webclient/js"></script>
|
||||||
|
<script type="text/javascript">
|
||||||
|
$(function() {
|
||||||
|
$("body").on('click','button',function(ev){
|
||||||
|
eval($("pre.run").text());
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>OpenERP web_api examples</h1>
|
||||||
|
<h2>Example 1: Load the list of defined ir.model <button>Run it !</button></h2>
|
||||||
|
<blockquote>
|
||||||
|
<h3>Code: </h3>
|
||||||
|
<pre>
|
||||||
|
<script type="text/javascript" src="/web/webclient/js"></script>
|
||||||
|
<script type="text/javascript">
|
||||||
|
<pre id="ex1" class="run">
|
||||||
|
var instance = openerp.init(["web"]); // get a new instance
|
||||||
|
instance.session.session_bind(); // bind it to the right hostname
|
||||||
|
instance.session.session_authenticate("trunk", "admin", "admin", false).then(function() {
|
||||||
|
var ds = new instance.web.DataSetSearch(null, "ir.model");
|
||||||
|
ds.read_slice(['name','model'], {}).then(function(models){
|
||||||
|
_.each(models,function(m,i){
|
||||||
|
$("#ex1res").append("<li>" + m.model + " (" + m.name + ") </li>")
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</pre></script>
|
||||||
|
</pre>
|
||||||
|
<h3>Div for output:</h3>
|
||||||
|
<div id="ex1res" class="result">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</blockquote>
|
||||||
|
<h2>Help me to complete this examples on <a href="http://bazaar.launchpad.net/~openerp/openerp-web/trunk/view/head:/addons/web_api/static/src/example.html">launchpad</a></h2>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
|
@ -1,24 +0,0 @@
|
||||||
{
|
|
||||||
"name" : "OpenERP Web Web",
|
|
||||||
"category" : "Hidden",
|
|
||||||
"description":"""Openerp Web Web.""",
|
|
||||||
"version" : "2.0",
|
|
||||||
"depends" : [],
|
|
||||||
"installable" : False,
|
|
||||||
'auto_install': False,
|
|
||||||
'js' : [
|
|
||||||
"../web/static/lib/datejs/date-en-US.js",
|
|
||||||
"../web/static/lib/jquery/jquery-1.6.4.js",
|
|
||||||
"../web/static/lib/json/json2.js",
|
|
||||||
"../web/static/lib/qweb/qweb2.js",
|
|
||||||
"../web/static/lib/underscore/underscore.js",
|
|
||||||
"../web/static/lib/underscore/underscore.string.js",
|
|
||||||
"../web/static/src/js/boot.js",
|
|
||||||
"../web/static/src/js/core.js",
|
|
||||||
"../web/static/src/js/formats.js",
|
|
||||||
"../web/static/src/js/chrome.js",
|
|
||||||
"../web/static/src/js/data.js",
|
|
||||||
],
|
|
||||||
'css' : [
|
|
||||||
],
|
|
||||||
}
|
|
|
@ -1,51 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
<html style="height: 100%">
|
|
||||||
<head>
|
|
||||||
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
|
||||||
<title>OpenERP web_rpc example</title>
|
|
||||||
<style type="text/css">
|
|
||||||
pre.run {
|
|
||||||
border: 1px solid black; margin:0;padding:4px;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
<script type="text/javascript" src="/base/webclient/js?mods=web_rpc"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
$(function() {
|
|
||||||
$("#ex1but").bind("click",function(){
|
|
||||||
eval($("#ex1").text());
|
|
||||||
});
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<h1>OpenERP web_rpc examples</h1>
|
|
||||||
<h2>Example 1: Display a list of defined ir.model <button id="ex1but">Run it !</button> </h2>
|
|
||||||
<h3>Code: </h3>
|
|
||||||
<pre>
|
|
||||||
<script type="text/javascript" src="/base/webclient/js?mods=web_rpc"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
<pre id="ex1" class="run">
|
|
||||||
var c = openerp.init(); // get a new webclient
|
|
||||||
c._modules_loaded = true; // Hack to prevent loading of additional modules
|
|
||||||
|
|
||||||
var s = new c.base.Session(); // setup a Session
|
|
||||||
s.login("web-trunk", "admin", "admin", function() {
|
|
||||||
|
|
||||||
var ds = new c.base.DataSetSearch(s, "ir.model"); // DataSetSearch used to search, read
|
|
||||||
ds.read_slice(['name','model'], {}, function(users){
|
|
||||||
for(var i in users) {
|
|
||||||
$("#ex1res").append("<li>" + users[i].model + " (" + users[i].name + ") </li>")
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
);
|
|
||||||
</pre></script>
|
|
||||||
</pre>
|
|
||||||
<h3>Div for output:</h3>
|
|
||||||
<div id="ex1res" style="border: 1px solid black;">
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<h2>Help me to complete this example page on <a href="http://bazaar.launchpad.net/~openerp/openerp-web/trunk/view/head:/addons/web_rpc/static/src/example.html">launchpad</a></h2>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
|
|
Loading…
Reference in New Issue