From 7e7c583d24bbb1605f5a48e2e7b470d638e5b65f Mon Sep 17 00:00:00 2001 From: Antony Lesuisse Date: Sun, 19 Aug 2012 03:06:46 +0200 Subject: [FIX] web_api example, renamed from web_rpc bzr revid: al@openerp.com-20120819010646-ujct3dwe9j0pmjq6 --- addons/web_api/static/src/example.html | 55 ++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 addons/web_api/static/src/example.html (limited to 'addons/web_api/static/src') 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 @@ + + + + + + OpenERP web_api example + + + + +

OpenERP web_api examples

+

Example 1: Load the list of defined ir.model

+
+

Code:

+
+<script type="text/javascript" src="/web/webclient/js"></script>
+<script type="text/javascript">
+
+    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>")
+            });
+        });
+    });
+
</script> +
+

Div for output:

+
+   +
+
+

Help me to complete this examples on launchpad

+ + + -- cgit v1.2.3