Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
Coopdevs OCB mirror
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Coopdevs
Odoo
Coopdevs OCB mirror
Commits
95c82509
Commit
95c82509
authored
10 years ago
by
Xavier Morel
Browse files
Options
Downloads
Patches
Plain Diff
[IMP] doc: try to make some bits of the porting guide less confusing
parent
1338f3af
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
doc/reference/orm.rst
+12
-11
12 additions, 11 deletions
doc/reference/orm.rst
with
12 additions
and
11 deletions
doc/reference/orm.rst
+
12
−
11
View file @
95c82509
...
...
@@ -1032,14 +1032,15 @@ Porting from the old API
* 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
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
field type with either a ``related`` or a ``compute`` parameter
*
``
depends`
`
on
field
compute methods **must be complete**,
it must list
**all** the fields and sub-fields which the compute method
uses. It is
better to have too many dependencies (will recompute the field
in cases
where that is not needed) than not enough (will forget to recompute
the
field and then values will be incorrect)
field type with either a ``related
=
`` or a ``compute
=
`` parameter
*
:func:`~openerp.api.
depends` on
``
compute
=``
methods **must be complete**,
it must list
**all** the fields and sub-fields which the compute method
uses. It is
better to have too many dependencies (will recompute the field
in cases
where that is not needed) than not enough (will forget to recompute
the
field and then values will be incorrect)
* **remove** all ``onchange`` methods on computed fields. Computed fields are
automatically re-computed when one of their dependencies is changed, and
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
* remove :attr:`~openerp.models.Model._default`, replace by ``default=``
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")
it is useless and should be removed
* ``multi`` does not do anything on new API fields use the same
``compute``
methods on all relevant fields for the same result
* provide ``compute``, ``inverse`` and ``search`` methods by name (as a
*
the
``multi
=
``
parameter
does not do anything on new API fields use the same
``compute=``
methods on all relevant fields for the same result
* provide ``compute
=
``, ``inverse
=
`` and ``search
=
`` methods by name (as a
string), this makes them overridable (removes the need for an intermediate
"trampoline" function)
* double check that all fields and methods have different names, there is no
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment