summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorRobot Odoo <xmo+roboto@odoo.com>2019-07-17 14:17:57 +0200
committerGitHub <noreply@github.com>2019-07-17 14:17:57 +0200
commitcc62447a44c2cf4e2edaf8a1f6d94520e799ddd9 (patch)
treea45f0984af5db1723fec83741b285ea92ab63598 /doc
parentf6fdde96bddfedf8764cd8a73089e44340d476ae (diff)
parenta8767716cfd14abc7f87204d4d180811f663b648 (diff)
[MERGE] api.py: remove calls to @api.multi and deprecate its explicit usage
depends on https://github.com/odoo/odoo/pull/34556 closes odoo/odoo#34775 Signed-off-by: Adrian Torres <Elkasitu@users.noreply.github.com>
Diffstat (limited to 'doc')
-rw-r--r--doc/howtos/backend.rst1
-rw-r--r--doc/howtos/profilecode.rst1
-rw-r--r--doc/reference/guidelines.rst13
-rw-r--r--doc/reference/orm.rst10
4 files changed, 4 insertions, 21 deletions
diff --git a/doc/howtos/backend.rst b/doc/howtos/backend.rst
index a5d03443f52..90300568c8f 100644
--- a/doc/howtos/backend.rst
+++ b/doc/howtos/backend.rst
@@ -789,7 +789,6 @@ method should simply set the value of the field to compute on every record in
name = fields.Char(compute='_compute_name')
- @api.multi
def _compute_name(self):
for record in self:
record.name = str(random.randint(1, 1e6))
diff --git a/doc/howtos/profilecode.rst b/doc/howtos/profilecode.rst
index ed6d2640648..1251c052ff7 100644
--- a/doc/howtos/profilecode.rst
+++ b/doc/howtos/profilecode.rst
@@ -20,7 +20,6 @@ its sub-called methods.
from odoo.tools.profiler import profile
[...]
@profile('/temp/prof.profile')
- @api.multi
def mymethod(...)
This produces a file called /temp/prof.profile
diff --git a/doc/reference/guidelines.rst b/doc/reference/guidelines.rst
index de9723121ff..c1a282cf19f 100644
--- a/doc/reference/guidelines.rst
+++ b/doc/reference/guidelines.rst
@@ -586,13 +586,11 @@ Programming in Odoo
Make your method work in batch
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-When adding a function, make sure it can process multiple records. Typically,
-such methods are decorated with the ``api.multi`` decorator. Then you will have
-to iterate on ``self`` to treat each record.
+When adding a function, make sure it can process multiple records by iterating
+on self to treat each record.
.. code-block:: python
- @api.multi
def my_method(self)
for record in self:
record.do_cool_stuff()
@@ -607,7 +605,6 @@ is recommended to use ``read_group`` method, to compute all value in only one re
.. code-block:: python
- @api.multi
def _compute_equipment_count(self):
""" Count the number of equipement per category """
equipment_data = self.env['hr.equipment'].read_group([('category_id', 'in', self.ids)], ['category_id'], ['category_id'])
@@ -943,8 +940,8 @@ Symbols and Conventions
- Selection method: the selection method pattern is *_selection_<field_name>*
- Onchange method : the onchange method pattern is *_onchange_<field_name>*
- Constraint method : the constraint method pattern is *_check_<constraint_name>*
- - Action method : an object action method is prefix with *action_*. Its decorator is
- ``@api.multi``, but since it use only one record, add ``self.ensure_one()``
+ - Action method : an object action method is prefix with *action_*.
+ Since it uses only one record, add ``self.ensure_one()``
at the beginning of the method.
- In a Model attribute order should be
@@ -979,7 +976,6 @@ Symbols and Conventions
event_type = fields.Selection(string="Type", selection='_selection_type')
# compute and search fields, in the same order of fields declaration
- @api.multi
@api.depends('seats_max', 'registration_ids.state', 'registration_ids.nb_register')
def _compute_seats(self):
...
@@ -1002,7 +998,6 @@ Symbols and Conventions
...
# Action methods
- @api.multi
def action_validate(self):
self.ensure_one()
...
diff --git a/doc/reference/orm.rst b/doc/reference/orm.rst
index 20440d5c414..47e8b1c9d61 100644
--- a/doc/reference/orm.rst
+++ b/doc/reference/orm.rst
@@ -565,16 +565,6 @@ Two decorators can expose a new-style method to the old API:
# can be called as
old_style_model.some_method(cr, uid, a_value, context=context)
-:func:`~odoo.api.multi`
- the method is exposed as taking a list of ids (possibly empty), its
- "old API" signature is ``cr, uid, ids, *arguments, context``::
-
- @api.multi
- def some_method(self, a_value):
- pass
- # 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.