[IMP] doc/howtos/backend: finalize section on translations, and other small fixes
This commit is contained in:
parent
aad19c7360
commit
0e74967b9a
|
@ -689,7 +689,8 @@ instead of a single view its ``arch`` field is composed of any number of
|
||||||
.. exercise:: Alter existing content
|
.. exercise:: Alter existing content
|
||||||
|
|
||||||
* Using model inheritance, modify the existing *Partner* model to add an
|
* 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
|
* Using view inheritance, display this fields in the partner form view
|
||||||
|
|
||||||
.. only:: solutions
|
.. only:: solutions
|
||||||
|
@ -1410,10 +1411,10 @@ the language and country combination when they differ (e.g. pt.po or
|
||||||
pt_BR.po). Translations will be loaded automatically by Odoo for all
|
pt_BR.po). Translations will be loaded automatically by Odoo for all
|
||||||
enabled languages. Developers always use English when creating a module, then
|
enabled languages. Developers always use English when creating a module, then
|
||||||
export the module terms using Odoo's gettext POT export feature
|
export the module terms using Odoo's gettext POT export feature
|
||||||
(Settings>Translations>Export a Translation File without specifying a
|
(:menuselection:`Settings --> Translations --> Import/Export --> Export
|
||||||
language), to create the module template POT file, and then derive the
|
Translation` without specifying a language), to create the module template POT
|
||||||
translated PO files. Many IDE's have plugins or modes for editing and merging
|
file, and then derive the translated PO files. Many IDE's have plugins or modes
|
||||||
PO/POT files.
|
for editing and merging PO/POT files.
|
||||||
|
|
||||||
.. tip:: The GNU gettext format (Portable Object) used by Odoo is
|
.. tip:: The GNU gettext format (Portable Object) used by Odoo is
|
||||||
integrated into LaunchPad, making it an online collaborative
|
integrated into LaunchPad, making it an online collaborative
|
||||||
|
@ -1432,8 +1433,8 @@ PO/POT files.
|
||||||
|
|
||||||
By default Odoo's POT export only extracts labels inside XML files or
|
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
|
inside field definitions in Python code, but any Python string can be
|
||||||
translated this way by surrounding it with the tools.translate._ method
|
translated this way by surrounding it with the function :func:`openerp._`
|
||||||
(e.g. _(‘Label') )
|
(e.g. ``_("Label")``)
|
||||||
|
|
||||||
.. exercise:: Translate a module
|
.. exercise:: Translate a module
|
||||||
|
|
||||||
|
@ -1446,8 +1447,8 @@ PO/POT files.
|
||||||
#. Install whichever language you want (
|
#. Install whichever language you want (
|
||||||
:menuselection:`Administration --> Translations --> Load an
|
:menuselection:`Administration --> Translations --> Load an
|
||||||
Official Translation`)
|
Official Translation`)
|
||||||
#. Synchronize translatable terms (:menuselection`Administration -->
|
#. Synchronize translatable terms (:menuselection:`Administration -->
|
||||||
Translations --> Application termsn --> Synchronize Translations`)
|
Translations --> Application Terms --> Synchronize Translations`)
|
||||||
#. Create a template translation file by exporting (
|
#. Create a template translation file by exporting (
|
||||||
:menuselection:`Administration --> Translations -> Import/Export
|
:menuselection:`Administration --> Translations -> Import/Export
|
||||||
--> Export Translation`) without specifying a language, save in
|
--> Export Translation`) without specifying a language, save in
|
||||||
|
@ -1460,20 +1461,13 @@ PO/POT files.
|
||||||
dedicated PO-file editor e.g. POEdit_ and translate the missing
|
dedicated PO-file editor e.g. POEdit_ and translate the missing
|
||||||
terms
|
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
|
#. Add ``from openerp import _`` to ``course.py`` and
|
||||||
mark missing strings as translatable
|
mark missing strings as translatable
|
||||||
|
|
||||||
.. todo:: there isn't any!
|
|
||||||
|
|
||||||
#. Repeat steps 3-6
|
#. Repeat steps 3-6
|
||||||
|
|
||||||
|
.. patch::
|
||||||
|
|
||||||
.. todo:: do we never reload translations?
|
.. todo:: do we never reload translations?
|
||||||
|
|
||||||
|
|
||||||
|
@ -1483,7 +1477,7 @@ Reporting
|
||||||
Printed reports
|
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_.
|
`Twitter Bootstrap`_ and Wkhtmltopdf_.
|
||||||
|
|
||||||
A report is a combination two elements:
|
A report is a combination two elements:
|
||||||
|
@ -1576,16 +1570,15 @@ WebServices
|
||||||
|
|
||||||
The web-service module offer a common interface for all web-services :
|
The web-service module offer a common interface for all web-services :
|
||||||
|
|
||||||
• SOAP
|
- XML-RPC
|
||||||
• XML-RPC
|
- JSON-RPC
|
||||||
• NET-RPC
|
|
||||||
|
|
||||||
Business objects can also be accessed via the distributed object
|
Business objects can also be accessed via the distributed object
|
||||||
mechanism. They can all be modified via the client interface with contextual
|
mechanism. They can all be modified via the client interface with contextual
|
||||||
views.
|
views.
|
||||||
|
|
||||||
Odoo is accessible through XML-RPC interfaces, for which libraries exist in
|
Odoo is accessible through XML-RPC/JSON-RPC interfaces, for which libraries
|
||||||
many languages.
|
exist in many languages.
|
||||||
|
|
||||||
XML-RPC Library
|
XML-RPC Library
|
||||||
---------------
|
---------------
|
||||||
|
@ -1667,10 +1660,10 @@ server with the library xmlrpclib.
|
||||||
* https://github.com/nicolas-van/openerp-client-lib
|
* https://github.com/nicolas-van/openerp-client-lib
|
||||||
* https://pypi.python.org/pypi/oersted/
|
* https://pypi.python.org/pypi/oersted/
|
||||||
|
|
||||||
.. [#autofields] it is possible to :attr:`disable the creation of some
|
.. [#autofields] it is possible to :attr:`disable the automatic creation of some
|
||||||
<openerp.models.Model._log_access>`
|
fields <openerp.models.Model._log_access>`
|
||||||
.. [#rawsql] writing raw SQL queries is possible, but requires care as it
|
.. [#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:
|
.. _database index:
|
||||||
http://use-the-index-luke.com/sql/preface
|
http://use-the-index-luke.com/sql/preface
|
||||||
|
|
|
@ -0,0 +1,39 @@
|
||||||
|
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"))
|
|
@ -31,5 +31,6 @@ exercise-state-workflow-automatic
|
||||||
exercise-state-workflow-actions
|
exercise-state-workflow-actions
|
||||||
exercise-access-rights
|
exercise-access-rights
|
||||||
exercise-access-rules
|
exercise-access-rules
|
||||||
|
exercise-translations
|
||||||
exercise-report
|
exercise-report
|
||||||
exercise-dashboard
|
exercise-dashboard
|
||||||
|
|
Loading…
Reference in New Issue