52 lines
1.9 KiB
HTML
52 lines
1.9 KiB
HTML
<!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>
|
|
|