summaryrefslogtreecommitdiff
path: root/doc/reference/guidelines.rst
diff options
context:
space:
mode:
authorYenthe V.G <yenthevg@gmail.com>2017-11-14 13:24:37 +0100
committerMartin Trigaux <mat@odoo.com>2017-11-14 16:27:33 +0100
commitf4d08ade92031f3bda2fb7648add83d3a0822a3e (patch)
tree7c56291367e02346fb6e3f3113d8fe1138281bfc /doc/reference/guidelines.rst
parent0dcf139aa763b05f0600c7d6e2ccea70be2148ef (diff)
[FIX] doc: remove reference to old vs new API
There is only one API, long live Odoo's API! Closes #20928
Diffstat (limited to 'doc/reference/guidelines.rst')
-rw-r--r--doc/reference/guidelines.rst28
1 files changed, 11 insertions, 17 deletions
diff --git a/doc/reference/guidelines.rst b/doc/reference/guidelines.rst
index 92f2a223d78..f04050b011e 100644
--- a/doc/reference/guidelines.rst
+++ b/doc/reference/guidelines.rst
@@ -8,7 +8,7 @@ Odoo Guidelines
This page introduces the new Odoo Coding Guidelines. Those aim to improve the quality of the code (e.g. better readability of source) and Odoo Apps. Indeed, proper code eases maintenance, aids debugging, lowers complexity and promotes reliability.
-These guidelines should be applied to every new module, and new developpment. These guidelines will be applied to old module **only** in case of code refactoring (migration to new API, big refactoring, ...).
+These guidelines should be applied to every new module, and new development.
.. warning::
@@ -23,7 +23,7 @@ Module structure
Directories
-----------
-A module is organised in important directories. Those contain the business logic; having a look at them should make understand the purpose of the module.
+A module is organised in important directories. Those contain the business logic; having a look at them should make you understand the purpose of the module.
- *data/* : demo and data xml
- *models/* : models definition
@@ -487,12 +487,11 @@ Programming in Odoo
ease code reading and performance.
-Make your method works in batch
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Make your method work in batch
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
When adding a function, make sure it can process multiple records. Typically,
-such method is decorated with ``api.multi`` decorator (or takes a list of *id*,
-if written in old api). Then you will have to iterate on ``self`` to treat each
-record.
+such methods are decorated with the ``api.multi`` decorator. Then you will have
+to iterate on ``self`` to treat each record.
.. code-block:: python
@@ -522,8 +521,8 @@ is recommended to use ``read_group`` method, to compute all value in only one re
Propagate the context
~~~~~~~~~~~~~~~~~~~~~
-In new API, the context is a ``frozendict`` that cannot be modified. To call
-a method with a different context, the ``with_context`` method should be used :
+The context is a ``frozendict`` that cannot be modified. To call a method with
+a different context, the ``with_context`` method should be used :
.. code-block:: python
@@ -789,8 +788,7 @@ Symbols and Conventions
- When defining *report* model (SQL views e.i.) : use
``<related_base_model>.report.<action>``, based on the Transient convention.
-- Odoo Python Class : use camelcase for code in api v8 (Object-oriented style),
- underscore lowercase notation for old api (SQL style).
+- Odoo Python Class : use camelcase for code.
.. code-block:: python
@@ -798,15 +796,11 @@ Symbols and Conventions
class AccountInvoice(models.Model):
...
- class account_invoice(osv.osv):
- ...
-
- Variable name :
- use camelcase for model variable
- use underscore lowercase notation for common variable.
- - since new API works with record or recordset instead of id list, don't
- suffix variable name with *_id* or *_ids* if they not contain id or list
- of id.
+ - Odoo works with a record or a recordset, don't suffix variable names with
+ *_id* or *_ids* if they don't contain an id or a list of ids.
.. code-block:: python