summaryrefslogtreecommitdiff
path: root/doc/reference/guidelines.rst
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2016-05-04 15:42:26 +0200
committerChristophe Simonis <chs@odoo.com>2016-05-04 15:42:26 +0200
commit1e86774207d09c901c61b148c5c0c23a511aa282 (patch)
tree7d6c73340d53727352255adb0daf84b076c7fe98 /doc/reference/guidelines.rst
parent13b34c26948f50f63774bfee5579b57565c9f40c (diff)
parent89873cbed5fb31547843a7a135145d46986431af (diff)
[MERGE] forward port of branch saas-9 up to 89873cb
Diffstat (limited to 'doc/reference/guidelines.rst')
-rw-r--r--doc/reference/guidelines.rst10
1 files changed, 9 insertions, 1 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