[IMP] doc: try to make some bits of the porting guide less confusing
This commit is contained in:
parent
1338f3af35
commit
95c8250992
|
@ -1032,14 +1032,15 @@ Porting from the old API
|
||||||
* methods still written in the old API should be automatically bridged by the
|
* methods still written in the old API should be automatically bridged by the
|
||||||
ORM, no need to switch to the old API, just call them as if they were a new
|
ORM, no need to switch to the old API, just call them as if they were a new
|
||||||
API method. See :ref:`reference/orm/oldapi/bridging` for more details.
|
API method. See :ref:`reference/orm/oldapi/bridging` for more details.
|
||||||
* ``search`` returns a recordset, no point in e.g. browsing its result
|
* :meth:`~openerp.models.Model.search` returns a recordset, no point in e.g.
|
||||||
|
browsing its result
|
||||||
* ``fields.related`` and ``fields.function`` are replaced by using a normal
|
* ``fields.related`` and ``fields.function`` are replaced by using a normal
|
||||||
field type with either a ``related`` or a ``compute`` parameter
|
field type with either a ``related=`` or a ``compute=`` parameter
|
||||||
* ``depends`` on field compute methods **must be complete**, it must list
|
* :func:`~openerp.api.depends` on ``compute=`` methods **must be complete**,
|
||||||
**all** the fields and sub-fields which the compute method uses. It is
|
it must list **all** the fields and sub-fields which the compute method
|
||||||
better to have too many dependencies (will recompute the field in cases
|
uses. It is better to have too many dependencies (will recompute the field
|
||||||
where that is not needed) than not enough (will forget to recompute the
|
in cases where that is not needed) than not enough (will forget to recompute
|
||||||
field and then values will be incorrect)
|
the field and then values will be incorrect)
|
||||||
* **remove** all ``onchange`` methods on computed fields. Computed fields are
|
* **remove** all ``onchange`` methods on computed fields. Computed fields are
|
||||||
automatically re-computed when one of their dependencies is changed, and
|
automatically re-computed when one of their dependencies is changed, and
|
||||||
that is used to auto-generate ``onchange`` by the client
|
that is used to auto-generate ``onchange`` by the client
|
||||||
|
@ -1048,14 +1049,14 @@ Porting from the old API
|
||||||
new-api (e.g. compute) they are useless
|
new-api (e.g. compute) they are useless
|
||||||
* remove :attr:`~openerp.models.Model._default`, replace by ``default=``
|
* remove :attr:`~openerp.models.Model._default`, replace by ``default=``
|
||||||
parameter on corresponding fields
|
parameter on corresponding fields
|
||||||
* if a field's ``string`` is the titlecased version of the field name::
|
* if a field's ``string=`` is the titlecased version of the field name::
|
||||||
|
|
||||||
name = fields.Char(string="Name")
|
name = fields.Char(string="Name")
|
||||||
|
|
||||||
it is useless and should be removed
|
it is useless and should be removed
|
||||||
* ``multi`` does not do anything on new API fields use the same ``compute``
|
* the ``multi=`` parameter does not do anything on new API fields use the same
|
||||||
methods on all relevant fields for the same result
|
``compute=`` methods on all relevant fields for the same result
|
||||||
* provide ``compute``, ``inverse`` and ``search`` methods by name (as a
|
* provide ``compute=``, ``inverse=`` and ``search=`` methods by name (as a
|
||||||
string), this makes them overridable (removes the need for an intermediate
|
string), this makes them overridable (removes the need for an intermediate
|
||||||
"trampoline" function)
|
"trampoline" function)
|
||||||
* double check that all fields and methods have different names, there is no
|
* double check that all fields and methods have different names, there is no
|
||||||
|
|
Loading…
Reference in New Issue