summaryrefslogtreecommitdiff
path: root/doc/reference
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2017-07-07 14:30:30 +0200
committerChristophe Simonis <chs@odoo.com>2017-07-07 14:30:30 +0200
commitbf51fe55a149fb642a410f579dc4b6dcbd794eac (patch)
treef4f208f06094bcef6541fd1fc034e0265de4ad21 /doc/reference
parentbf32940142beb879211b7034bb77a7845c9d0555 (diff)
parent0f2b2c4e2b99df8d68456016a4bea86e26c1c80e (diff)
[MERGE] forward port branch saas-16 up to 0f2b2c4e2b9
Diffstat (limited to 'doc/reference')
-rw-r--r--doc/reference/orm.rst10
-rw-r--r--doc/reference/views.rst5
2 files changed, 13 insertions, 2 deletions
diff --git a/doc/reference/orm.rst b/doc/reference/orm.rst
index 876d74f65cc..00b284f9cb2 100644
--- a/doc/reference/orm.rst
+++ b/doc/reference/orm.rst
@@ -45,14 +45,20 @@ Field access
------------
Recordsets provide an "Active Record" interface: model fields can be read and
-written directly from the record, but only on singletons (single-record
-recordsets). Setting a field's value triggers an update to the database::
+written directly from the record as attributes, but only on singletons
+(single-record recordsets).
+Field values can also be accessed like dict items, which is more elegant and
+safer than ``getattr()`` for dynamic field names.
+Setting a field's value triggers an update to the database::
>>> record.name
Example Name
>>> record.company_id.name
Company Name
>>> record.name = "Bob"
+ >>> field = "name"
+ >>> record[field]
+ Bob
Trying to read or write a field on multiple records will raise an error.
diff --git a/doc/reference/views.rst b/doc/reference/views.rst
index 8b90ca00f44..2a9b5ece4bc 100644
--- a/doc/reference/views.rst
+++ b/doc/reference/views.rst
@@ -237,6 +237,11 @@ Possible children elements of the list view are:
Makes the button ``invisible`` if the record is *not* in one of the
listed states
+
+ .. danger::
+
+ Using ``states`` in combination with ``attrs`` may lead to
+ unexpected results as domains are combined with a logical AND.
``context``
merged into the view's context when performing the button's Odoo call
``confirm``