.. exercise:: Alter existing content
* Using model inheritance, modify the existing *Partner* model to add an
- ``instructor`` boolean field
+ ``instructor`` boolean field, and a many2many field that corresponds to
+ the session-partner relation
* Using view inheritance, display this fields in the partner form view
.. only:: solutions
pt_BR.po). Translations will be loaded automatically by Odoo for all
enabled languages. Developers always use English when creating a module, then
export the module terms using Odoo's gettext POT export feature
-(Settings>Translations>Export a Translation File without specifying a
-language), to create the module template POT file, and then derive the
-translated PO files. Many IDE's have plugins or modes for editing and merging
-PO/POT files.
+(:menuselection:`Settings --> Translations --> Import/Export --> Export
+Translation` without specifying a language), to create the module template POT
+file, and then derive the translated PO files. Many IDE's have plugins or modes
+for editing and merging PO/POT files.
.. tip:: The GNU gettext format (Portable Object) used by Odoo is
integrated into LaunchPad, making it an online collaborative
By default Odoo's POT export only extracts labels inside XML files or
inside field definitions in Python code, but any Python string can be
- translated this way by surrounding it with the tools.translate._ method
- (e.g. _(‘Label') )
+ translated this way by surrounding it with the function :func:`openerp._`
+ (e.g. ``_("Label")``)
.. exercise:: Translate a module
#. Install whichever language you want (
:menuselection:`Administration --> Translations --> Load an
Official Translation`)
- #. Synchronize translatable terms (:menuselection`Administration -->
- Translations --> Application termsn --> Synchronize Translations`)
+ #. Synchronize translatable terms (:menuselection:`Administration -->
+ Translations --> Application Terms --> Synchronize Translations`)
#. Create a template translation file by exporting (
:menuselection:`Administration --> Translations -> Import/Export
--> Export Translation`) without specifying a language, save in
dedicated PO-file editor e.g. POEdit_ and translate the missing
terms
- .. note::
-
- By default, Odoo's export only extracts labels inside XML
- records or Python field definitions, but arbitrary Python
- strings can be marked as translatable by calling
- :func:`openerp._` with them e.g. ``_("Label")``)
-
#. Add ``from openerp import _`` to ``course.py`` and
mark missing strings as translatable
- .. todo:: there isn't any!
-
#. Repeat steps 3-6
+ .. patch::
+
.. todo:: do we never reload translations?
Printed reports
---------------
-Odoo v8 comes with a new report engine based on :ref:`reference/qweb`,
+Odoo 8.0 comes with a new report engine based on :ref:`reference/qweb`,
`Twitter Bootstrap`_ and Wkhtmltopdf_.
A report is a combination two elements:
The web-service module offer a common interface for all web-services :
-• SOAP
-• XML-RPC
-• NET-RPC
+- XML-RPC
+- JSON-RPC
Business objects can also be accessed via the distributed object
mechanism. They can all be modified via the client interface with contextual
views.
-Odoo is accessible through XML-RPC interfaces, for which libraries exist in
-many languages.
+Odoo is accessible through XML-RPC/JSON-RPC interfaces, for which libraries
+exist in many languages.
XML-RPC Library
---------------
* https://github.com/nicolas-van/openerp-client-lib
* https://pypi.python.org/pypi/oersted/
-.. [#autofields] it is possible to :attr:`disable the creation of some
- <openerp.models.Model._log_access>`
+.. [#autofields] it is possible to :attr:`disable the automatic creation of some
+ fields <openerp.models.Model._log_access>`
.. [#rawsql] writing raw SQL queries is possible, but requires care as it
- bypasses all Odoo authentication and security mechanisms.
+ bypasses all Odoo authentication and security mechanisms.
.. _database index:
http://use-the-index-luke.com/sql/preface
--- /dev/null
+Index: doc-backend/openacademy/models.py
+===================================================================
+--- doc-backend.orig/openacademy/models.py 2014-08-25 14:43:52.288143046 +0200
++++ doc-backend/openacademy/models.py 2014-08-25 14:49:46.148137793 +0200
+@@ -1,7 +1,7 @@
+ # -*- coding: utf-8 -*-
+
+ from datetime import timedelta
+-from openerp import models, fields, api, exceptions
++from openerp import models, fields, api, exceptions, _
+
+ class Course(models.Model):
+ _name = 'openacademy.course'
+@@ -85,15 +85,15 @@
+ if self.seats < 0:
+ return {
+ 'warning': {
+- 'title': "Incorrect 'seats' value",
+- 'message': "The number of available seats may not be negative",
++ 'title': _("Incorrect 'seats' value"),
++ 'message': _("The number of available seats may not be negative"),
+ },
+ }
+ if self.seats < len(self.attendee_ids):
+ return {
+ 'warning': {
+- 'title': "Too many attendees",
+- 'message': "Increase seats or remove excess attendees",
++ 'title': _("Too many attendees"),
++ 'message': _("Increase seats or remove excess attendees"),
+ },
+ }
+
+@@ -135,4 +135,4 @@
+ @api.constrains('instructor_id', 'attendee_ids')
+ def _check_instructor_not_in_attendees(self):
+ if self.instructor_id and self.instructor_id in self.attendee_ids:
+- raise exceptions.ValidationError("A session's instructor can't be an attendee")
++ raise exceptions.ValidationError(_("A session's instructor can't be an attendee"))