[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
This commit is contained in:
Nicolas Lempereur 2014-12-01 09:10:16 +01:00 committed by Xavier Morel
parent 83b28737e9
commit 38f0508bba
6 changed files with 50 additions and 37 deletions

View File

@ -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 <https://pypi.python.org/pypi/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.

View File

@ -36,7 +36,7 @@ Index: addons/openacademy/views/openacademy.xml
+ </field>
+ </record>
+
+ <!-- top level menu: no paret -->
+ <!-- top level menu: no parent -->
+ <menuitem id="main_openacademy_menu" name="Open Academy"/>
+ <!-- A first level in the left side menu is needed
+ before using action= attribute -->

View File

@ -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 @@
+<?xml version="1.0"?>
+<openerp>
+ <data>
+ <record model="ir.actions.act_window" id="act_session_graph">
+ <field name="name">Attendees by course</field>
+ <field name="res_model">openacademy.session</field>
+ <field name="view_type">form</field>
+ <field name="view_mode">graph</field>
@ -38,12 +39,14 @@ Index: addons/openacademy/views/session_board.xml
+ ref="openacademy.openacademy_session_graph_view"/>
+ </record>
+ <record model="ir.actions.act_window" id="act_session_calendar">
+ <field name="name">Sessions</field>
+ <field name="res_model">openacademy.session</field>
+ <field name="view_type">form</field>
+ <field name="view_mode">calendar</field>
+ <field name="view_id" ref="openacademy.session_calendar_view"/>
+ </record>
+ <record model="ir.actions.act_window" id="act_course_list">
+ <field name="name">Courses</field>
+ <field name="res_model">openacademy.course</field>
+ <field name="view_type">form</field>
+ <field name="view_mode">tree,form</field>

View File

@ -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

View File

@ -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
<div class="oe_petstore_homepage_right"></div>
</div>
</t>
<t t-name="MessageofTheDay">
<t t-name="MessageOfTheDay">
<div class="oe_petstore_motd">
<p class="oe_mywidget_message_of_the_day"></p>
</div>

View File

@ -142,7 +142,7 @@ First define an Odoo model file and import it:
.. patch::
Then setup :ref:`basic access control <reference/security/acl>` 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 <reference/http/request>` 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
<openerp.models.Model._inherit>` 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