diff options
| author | Xavier Morel <xmo@openerp.com> | 2011-10-11 11:45:51 +0200 |
|---|---|---|
| committer | Xavier Morel <xmo@openerp.com> | 2011-10-11 11:45:51 +0200 |
| commit | 34fcc08a1f0722cd8eafd0dd2d8dd4d175f0e843 (patch) | |
| tree | 89cfbc83fad15eb5e2ebe30af4016f2baff29a59 | |
| parent | 8507ceddcf221b65b6214c24174737383f687452 (diff) | |
[IMP] docstring for resolve_o2m_commands_...
bzr revid: xmo@openerp.com-20111011094551-vr27on7iibdd9tv6
| -rw-r--r-- | openerp/osv/orm.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/openerp/osv/orm.py b/openerp/osv/orm.py index 1d5a65456b6..3d9f8324abe 100644 --- a/openerp/osv/orm.py +++ b/openerp/osv/orm.py @@ -4765,11 +4765,15 @@ class BaseModel(object): def resolve_o2m_commands_to_record_dicts(self, cr, uid, field_name, o2m_commands, fields=None, context=None): """ Serializes o2m commands into record dictionaries (as if all the o2m records came from the database via a read()), and - returns an iterator over these dictionaries. + returns an iterable over these dictionaries. Because o2m commands might be creation commands, not all record ids will contain an ``id`` field. Commands matching an - existing record (UPDATE and LINK_TO) will have an id. + existing record (``UPDATE`` and ``LINK_TO``) will have an id. + + .. note:: ``CREATE``, ``UPDATE`` and ``LINK_TO`` stand for the + o2m command codes ``0``, ``1`` and ``4`` + respectively :param field_name: name of the o2m field matching the commands :type field_name: str @@ -4778,10 +4782,11 @@ class BaseModel(object): :param fields: list of fields to read from the database, when applicable :type fields: list(str) :param context: request context + :raises AssertionError: if a command is not ``CREATE``, ``UPDATE`` or ``LINK_TO`` :returns: o2m records in a shape similar to that returned by ``read()`` (except records may be missing the ``id`` field if they don't exist in db) - :rtype: iter(dict) + :rtype: ``list(dict)`` """ o2m_model = self._all_columns[field_name].column._obj |
