From 38f0508bba7daf95d347e77abf15d184158da0e5 Mon Sep 17 00:00:00 2001 From: Nicolas Lempereur Date: Mon, 1 Dec 2014 09:10:16 +0100 Subject: [PATCH] [FIX] doc: typos and code samples from howtos * The dashboard from the backend howto doesn't specify "name" field which causes non-null constraint violation. * Some useful examples uses idea.idea" model which isn't available in 8.0 so I replaced them with "note.note". closes #3993 --- doc/howtos/backend.rst | 32 +++++++++++----------- doc/howtos/backend/exercise-basic-action | 2 +- doc/howtos/backend/exercise-dashboard | 5 +++- doc/howtos/themes.rst | 2 +- doc/howtos/web.rst | 34 +++++++++++++++--------- doc/howtos/website.rst | 12 ++++----- 6 files changed, 50 insertions(+), 37 deletions(-) diff --git a/doc/howtos/backend.rst b/doc/howtos/backend.rst index b72540cf2d3..e1ba28e3324 100644 --- a/doc/howtos/backend.rst +++ b/doc/howtos/backend.rst @@ -8,7 +8,7 @@ Start/Stop the Odoo server ========================== Odoo uses a client/server architecture in which clients are web browsers -accessing the odoo server via RPC. +accessing the Odoo server via RPC. Business logic and extension is generally performed on the server side, although supporting client features (e.g. new data representation such as @@ -1691,14 +1691,14 @@ server with the library ``xmlrpclib``:: uid = xmlrpclib.ServerProxy(root + 'common').login(DB, USER, PASS) print "Logged in as %s (uid: %d)" % (USER, uid) - # Create a new idea + # Create a new note sock = xmlrpclib.ServerProxy(root + 'object') args = { - 'name' : 'Another idea', - 'description' : 'This is another idea of mine', - 'inventor_id': uid, + 'color' : 8, + 'memo' : 'This is a note', + 'create_uid': uid, } - idea_id = sock.execute(DB, uid, PASS, 'idea.idea', 'create', args) + note_id = sock.execute(DB, uid, PASS, 'note.note', 'create', args) .. exercise:: Add a new service to the client @@ -1780,13 +1780,13 @@ with the standard Python libraries ``urllib2`` and ``json``:: url = "http://%s:%s/jsonrpc" % (HOST, PORT) uid = call(url, "common", "login", DB, USER, PASS) - # create a new idea + # create a new note args = { - 'name' : 'Another idea', - 'description' : 'This is another idea of mine', - 'inventor_id': uid, + 'color' : 8, + 'memo' : 'This is another note', + 'create_uid': uid, } - idea_id = call(url, "object", "execute", DB, uid, PASS, 'idea.idea', 'create', args) + note_id = call(url, "object", "execute", DB, uid, PASS, 'note.note', 'create', args) Here is the same program, using the library `jsonrpclib `:: @@ -1805,13 +1805,13 @@ Here is the same program, using the library args = [DB, uid, PASS, model, method] + list(args) return server.call(service="object", method="execute", args=args) - # create a new idea + # create a new note args = { - 'name' : 'Another idea', - 'description' : 'This is another idea of mine', - 'inventor_id': uid, + 'color' : 8, + 'memo' : 'This is another note', + 'create_uid': uid, } - idea_id = invoke('idea.idea', 'create', args) + note_id = invoke('note.note', 'create', args) Examples can be easily adapted from XML-RPC to JSON-RPC. diff --git a/doc/howtos/backend/exercise-basic-action b/doc/howtos/backend/exercise-basic-action index 1287315653f..ac84e344d6a 100644 --- a/doc/howtos/backend/exercise-basic-action +++ b/doc/howtos/backend/exercise-basic-action @@ -36,7 +36,7 @@ Index: addons/openacademy/views/openacademy.xml + + + -+ ++ + + diff --git a/doc/howtos/backend/exercise-dashboard b/doc/howtos/backend/exercise-dashboard index 7c76e690207..bf175edc7d3 100644 --- a/doc/howtos/backend/exercise-dashboard +++ b/doc/howtos/backend/exercise-dashboard @@ -26,11 +26,12 @@ Index: addons/openacademy/views/session_board.xml =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ addons/openacademy/views/session_board.xml 2014-08-26 17:26:21.531783052 +0200 -@@ -0,0 +1,63 @@ +@@ -0,0 +1,66 @@ + + + + ++ Attendees by course + openacademy.session + form + graph @@ -38,12 +39,14 @@ Index: addons/openacademy/views/session_board.xml + ref="openacademy.openacademy_session_graph_view"/> + + ++ Sessions + openacademy.session + form + calendar + + + ++ Courses + openacademy.course + form + tree,form diff --git a/doc/howtos/themes.rst b/doc/howtos/themes.rst index 35cb43989aa..2c6eef2d405 100644 --- a/doc/howtos/themes.rst +++ b/doc/howtos/themes.rst @@ -8,7 +8,7 @@ Basic set up ============ Create a basic theme module with :command:`odoo.py scaffold` and the ``theme`` -template: from the root odoo folder, use +template: from the root Odoo folder, use .. code-block:: console diff --git a/doc/howtos/web.rst b/doc/howtos/web.rst index 384297dc6a9..8dc89d8f549 100644 --- a/doc/howtos/web.rst +++ b/doc/howtos/web.rst @@ -45,7 +45,14 @@ If you browse the ``petstore`` folder, you should see the following content: .. code-block:: text oepetstore + |-- images + | |-- alligator.jpg + | |-- ball.jpg + | |-- crazy_circle.jpg + | |-- fish.jpg + | `-- mice.jpg |-- __init__.py + |-- oepetstore.message_of_the_day.csv |-- __openerp__.py |-- petstore_data.xml |-- petstore.py @@ -78,9 +85,9 @@ sub-folders are conventional and not strictly necessary. currently look like:: openerp.oepetstore = function(instance, local) { - var _t = openerp.web._t, - _lt = openerp.web._lt; - var QWeb = openerp.web.qweb; + var _t = instance.web._t, + _lt = instance.web._lt; + var QWeb = instance.web.qweb; local.HomePage = instance.Widget.extend({ start: function() { @@ -88,8 +95,8 @@ sub-folders are conventional and not strictly necessary. }, }); - openerp.web.client_actions.add( - 'petstore.homepage', 'local.HomePage'); + instance.web.client_actions.add( + 'petstore.homepage', 'instance.oepetstore.HomePage'); } Which only prints a small message in the browser's console. @@ -528,7 +535,7 @@ characteristics: structural extensibility where an XML-based templating engine can be generically altered using e.g. XPath or CSS and a tree-alteration DSL (or even just XSLT). This flexibility and extensibility is a core - characteristic of Odoo, and losting it was considered unacceptable. + characteristic of Odoo, and losing it was considered unacceptable. Using QWeb ---------- @@ -1121,6 +1128,7 @@ Exercise }, start: function() { this.input_changed(); + return this._super(); }, input_changed: function() { var color = [ @@ -1136,9 +1144,9 @@ Exercise local.HomePage = instance.Widget.extend({ template: "HomePage", start: function() { - this.colorInput = new local.ColorInputWidget(this) - .on("change:color", this, this.color_changed); - .appendTo(this.$el); + this.colorInput = new local.ColorInputWidget(this); + this.colorInput.on("change:color", this, this.color_changed); + return this.colorInput.appendTo(this.$el); }, color_changed: function() { this.$(".oe_color_div").css("background-color", this.colorInput.get("color")); @@ -1560,8 +1568,10 @@ Exercises .filter([['categ_id.name', '=', "Pet Toys"]]) .limit(5) .all() - .then(function (result) { - self.$el.append(QWeb.render('PetToys', {item: item})); + .then(function (results) { + _(results).each(function (item) { + self.$el.append(QWeb.render('PetToy', {item: item})); + }); }); } }); @@ -1578,7 +1588,7 @@ Exercises
- +

diff --git a/doc/howtos/website.rst b/doc/howtos/website.rst index 2187956abaf..5092cac5df6 100644 --- a/doc/howtos/website.rst +++ b/doc/howtos/website.rst @@ -142,7 +142,7 @@ First define an Odoo model file and import it: .. patch:: Then setup :ref:`basic access control ` for the model -and and add them to the manifest: +and add them to the manifest: .. patch:: @@ -211,7 +211,7 @@ integration and a few other services (e.g. default styling, theming) via the #. then add the ``website=True`` flag on the controller, this sets up a few new variables on :ref:`the request object ` and allows using the website layout in our template -#. use the wesite layout in the template +#. use the website layout in the template .. patch:: @@ -307,7 +307,7 @@ interfaces. Change the *person* template to use ``t-field``: Restart Odoo and upgrade the module, there is now a placeholder under the teacher's name and a new zone for blocks in :guilabel:`Edit` mode. Content -dropped there is stored in the correspoding teacher's ``biography`` field, and +dropped there is stored in the corresponding teacher's ``biography`` field, and thus specific to that teacher. The teacher's name is also editable, and when saved the change is visible on @@ -344,7 +344,7 @@ The conceptual structure of the Odoo backend is simple: #. actions. Actions have various types: links, reports, code which Odoo should execute or data display. Data display actions are called *window actions*, and tell Odoo to display a given *model* according to a set of views… -#. a view has a type, a the broad category to which it corresponds (a list, +#. a view has a type, a broad category to which it corresponds (a list, a graph, a calendar) and an *architecture* which customises the way the model is displayed inside the view. @@ -457,8 +457,8 @@ though they may have to be looked for. * to extend a model in-place, it's :attr:`inherited ` without giving it a new :attr:`~openerp.models.Model._name` - * ``product.template`` already uses the discussions system, so we - can remove it from our extension model + * ``product.template`` already uses the discussions system, so we can + remove it from our extension model * we're creating our courses as *published* by default so they can be seen without having to log in