summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2018-08-27 16:44:17 +0200
committerChristophe Simonis <chs@odoo.com>2018-08-27 16:44:17 +0200
commit9947133361f4d6fc4c9cbb68e2e2230728fcdafd (patch)
tree4fc266cd52f55d94f86d7df2ab75323e35fde99c /doc
parentf7ead5fd50f4b6db2a1d4c947fc4e15dceedbbd7 (diff)
parent40430699dfbba715b143c109ebae415074da9f40 (diff)
[MERGE] forward port branch saas-11.5 up to 40430699dfb
Diffstat (limited to 'doc')
-rw-r--r--doc/_extensions/autojsdoc/parser/jsdoc.py5
-rw-r--r--doc/_extensions/autojsdoc/parser/parser.py5
-rw-r--r--doc/_extensions/odoo_ext/translator.py12
-rw-r--r--doc/reference/orm.rst25
-rw-r--r--doc/setup/enterprise.rst1
5 files changed, 43 insertions, 5 deletions
diff --git a/doc/_extensions/autojsdoc/parser/jsdoc.py b/doc/_extensions/autojsdoc/parser/jsdoc.py
index ff6d3196254..eb9d595330a 100644
--- a/doc/_extensions/autojsdoc/parser/jsdoc.py
+++ b/doc/_extensions/autojsdoc/parser/jsdoc.py
@@ -62,6 +62,11 @@ class CommentDoc(pyjsdoc.CommentDoc):
d['name'] = self.name
return d
+ # don't resolve already resolved docs (e.g. a literal dict being
+ # include-ed in two different classes because I don't even care anymore
+ def become(self, modules):
+ return self
+
class PropertyDoc(CommentDoc):
@classmethod
def from_param(cls, s, sourcemodule=None):
diff --git a/doc/_extensions/autojsdoc/parser/parser.py b/doc/_extensions/autojsdoc/parser/parser.py
index d979170bbc9..a5eb45a8e85 100644
--- a/doc/_extensions/autojsdoc/parser/parser.py
+++ b/doc/_extensions/autojsdoc/parser/parser.py
@@ -60,7 +60,7 @@ ref = collections.namedtuple('Ref', 'object property')
def _name(r):
bits = []
while isinstance(r, ref):
- bits.append(r.property)
+ bits.append(str(r.property))
r = r.object
return '.'.join(reversed(bits))
def deref(item, prop=None):
@@ -348,7 +348,8 @@ class ModuleExtractor(Visitor):
def resolve_extension(modules):
t = target.become(modules)
if not isinstance(t, jsdoc.ClassDoc):
- raise ValueError("include() subjects should be classes, %s is %s" % (target_name, type(t)))
+ return # FIXME: log warning
+ # raise ValueError("include() subjects should be classes, %s is %s" % (target_name, type(t)))
# TODO: note which module added these
for it in items:
if isinstance(it, dict):
diff --git a/doc/_extensions/odoo_ext/translator.py b/doc/_extensions/odoo_ext/translator.py
index da4e8731628..cf6c149d063 100644
--- a/doc/_extensions/odoo_ext/translator.py
+++ b/doc/_extensions/odoo_ext/translator.py
@@ -190,6 +190,18 @@ class BootstrapTranslator(nodes.NodeVisitor, object):
def depart_compact_paragraph(self, node):
pass
+ def visit_problematic(self, node):
+ if node.hasattr('refid'):
+ self.body.append('<a href="#%s">' % node['refid'])
+ self.context.append('</a>')
+ else:
+ self.context.append('')
+ self.body.append(self.starttag(node, 'span', CLASS='problematic'))
+
+ def depart_problematic(self, node):
+ self.body.append('</span>')
+ self.body.append(self.context.pop())
+
def visit_literal_block(self, node):
if node.rawsource != node.astext():
# most probably a parsed-literal block -- don't highlight
diff --git a/doc/reference/orm.rst b/doc/reference/orm.rst
index 1a0dba9edf1..14dfdb4c058 100644
--- a/doc/reference/orm.rst
+++ b/doc/reference/orm.rst
@@ -278,12 +278,18 @@ Common ORM methods
.. tip:: to just check if any record matches a domain, or count the number
of records which do, use
:meth:`~odoo.models.Model.search_count`
+
:meth:`~odoo.models.Model.create`
- Takes a number of field values, and returns a recordset containing the
- record created::
+ Takes a dictionary of field values, or a list of such dictionaries, and
+ returns a recordset containing the records created::
- >>> self.create({'name': "New Name"})
+ >>> self.create({'name': "Joe"})
res.partner(78)
+ >>> self.create([{'name': "Jack"}, {'name': "William"}, {'name': "Averell"}])
+ res.partner(79, 80, 81)
+
+ See :ref:`how to define method \`create\` with one API or the other
+ <reference/orm/oldapi>`.
:meth:`~odoo.models.Model.write`
Takes a number of field values, writes them to all the records in its
@@ -569,6 +575,19 @@ Two decorators can expose a new-style method to the old API:
# can be called as
old_style_model.some_method(cr, uid, [id1, id2], a_value, context=context)
+Note that a method `create` decorated with :func:`~odoo.api.model` will always
+be called with a single dictionary. A method `create` decorated with the variant
+:func:`~odoo.api.model_create_multi` will always be called with a list of dicts.
+The decorators take care of converting the argument to one form or the other::
+
+ @api.model
+ def create(self, vals):
+ ...
+
+ @api.model_create_multi
+ def create(self, vals_list):
+ ...
+
Because new-style APIs tend to return recordsets and old-style APIs tend to
return lists of ids, there is also a decorator managing this:
diff --git a/doc/setup/enterprise.rst b/doc/setup/enterprise.rst
index 66f8fe82671..0051b1fafc1 100644
--- a/doc/setup/enterprise.rst
+++ b/doc/setup/enterprise.rst
@@ -1,4 +1,5 @@
:banner: banners/enterprise.jpg
+
.. _setup/enterprise:
============================