diff options
Diffstat (limited to 'doc/reference')
| -rw-r--r-- | doc/reference/guidelines.rst | 10 | ||||
| -rw-r--r-- | doc/reference/orm.rst | 1 | ||||
| -rw-r--r-- | doc/reference/views.rst | 17 |
3 files changed, 22 insertions, 6 deletions
diff --git a/doc/reference/guidelines.rst b/doc/reference/guidelines.rst index e4cfe1255ec..54a00097705 100644 --- a/doc/reference/guidelines.rst +++ b/doc/reference/guidelines.rst @@ -11,6 +11,14 @@ aim to improve the quality of the code (better readability of source, ...) and Odoo Apps. Indeed, proper code ought ease maintenance, aid debugging, lower complexity and promote reliability. +.. warning:: + + These guidelines are written with new modules and new files in mind. When + modifying existing files, the original style of the file strictly supersedes + any other style guidelines. In other words, never modify existing files in + order to apply these guidelines, to avoid disrupting the revision history of + each line. For more details, see our `pull request guide <https://odoo.com/submit-pr>`_. + Module structure ================ @@ -271,7 +279,7 @@ Idioms - Always favor *Readability* over *conciseness* or using the language features or idioms. - Use list comprehension, dict comprehension, and basic manipulation using ``map``, ``filter``, ``sum``, ... They make the code easier to read. - The same applies for recordset methods : use ``filtered``, ``mapped``, ``sorted``, ... -- Each python file should have ``# -*- coding: utf-8 -*-`` as first line +- Each python file should have ``# coding: utf-8 `` as first line - Use the ``UserError`` defined in ``openerp.exceptions`` instead of overriding ``Warning``, or find a more appropriate exception in *exceptions.py* - Document your code (docstring on methods, simple comments for the tricky part of the code) - Use meaningful variable/class/method names diff --git a/doc/reference/orm.rst b/doc/reference/orm.rst index 9d232b417da..af5c3cb267f 100644 --- a/doc/reference/orm.rst +++ b/doc/reference/orm.rst @@ -678,6 +678,7 @@ Model Reference .. automethod:: write .. automethod:: read + .. automethod:: read_group .. rubric:: Research diff --git a/doc/reference/views.rst b/doc/reference/views.rst index 3c8eaa02126..6bed888f571 100644 --- a/doc/reference/views.rst +++ b/doc/reference/views.rst @@ -76,15 +76,19 @@ The result of applying children views yields the final ``arch`` Inheritance specs ----------------- -There are three types of inheritance specs: +Inheritance specs are comprised of an element locator, to match +the inherited element in the parent view, and children element that +will be used to modify the inherited element. + +There are three types of element locators for matching a target element: * An ``xpath`` element with an ``expr`` attribute. ``expr`` is an XPath_ expression\ [#hasclass]_ applied to the current ``arch``, the first node it finds is the match * a ``field`` element with a ``name`` attribute, matches the first ``field`` - with the same ``name`` -* any other element, the first element with the same name and identical - attributes (ignoring ``position``) is matched + with the same ``name``. All other attributes are ignored during matching +* any other element: the first element with the same name and identical + attributes (ignoring ``position`` and ``version`` attributes) is matched The inheritance spec may have an optional ``position`` attribute specifying how the matched node should be altered: @@ -92,7 +96,10 @@ how the matched node should be altered: ``inside`` (default) the content of the inheritance spec is appended to the matched node ``replace`` - the content of the inheritance spec replaces the matched node + the content of the inheritance spec replaces the matched node. + Any text node containing only `$0` within the contents of the spec will + be replaced by a complete copy of the matched node, effectively wrapping + the matched node. ``after`` the content of the inheritance spec is added to the matched node's parent, after the matched node |
