diff options
| author | Antony Lesuisse <al@openerp.com> | 2012-08-19 03:06:46 +0200 |
|---|---|---|
| committer | Antony Lesuisse <al@openerp.com> | 2012-08-19 03:06:46 +0200 |
| commit | 7e7c583d24bbb1605f5a48e2e7b470d638e5b65f (patch) | |
| tree | 902fc17f7a348423dd57b30394e98718520e7bb4 /addons/web_api/static | |
| parent | d43eb323f12df787e4b317094aceae8f4e04c330 (diff) | |
[FIX] web_api example, renamed from web_rpc
bzr revid: al@openerp.com-20120819010646-ujct3dwe9j0pmjq6
Diffstat (limited to 'addons/web_api/static')
| -rw-r--r-- | addons/web_api/static/src/example.html | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/addons/web_api/static/src/example.html b/addons/web_api/static/src/example.html new file mode 100644 index 00000000000..9c920e31fa2 --- /dev/null +++ b/addons/web_api/static/src/example.html @@ -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> + |
