From 0cd019210e8a0580ce42883c9f1e501dc4d3939a Mon Sep 17 00:00:00 2001 From: vava-odoo Date: Fri, 29 Nov 2024 09:48:58 +0000 Subject: [PATCH] [FIX] developer/tutorials/importable_modules: no self in actions In ir.actions.server, the variable containing the record(s) is not `self`, but `record` and `records`. Also, since there is a word about `store` attribute for computed fields, this commit specifies the behaviour of `readonly` attribute. closes odoo/documentation#11487 X-original-commit: d77d3ace2ab03af2136e426c9e7d0334adb461d7 Signed-off-by: Vallaeys Valentin (vava) --- content/developer/tutorials/importable_modules.rst | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/content/developer/tutorials/importable_modules.rst b/content/developer/tutorials/importable_modules.rst index 5388fb29d..d030d4076 100644 --- a/content/developer/tutorials/importable_modules.rst +++ b/content/developer/tutorials/importable_modules.rst @@ -524,7 +524,8 @@ Python code). Unlike in Python modules, computed fields are stored by default. If you wish for a computed field to not be stored (e.g., for performance reasons or to avoid database bloat), you can set the ``store`` -attribute to ``False``. +attribute to ``False``. The same applies to ``readonly``: if you want your computed field to not be +editable, you need to set the ``readonly`` attribute to ``True``. The `CDATA` section is used to specify to XML parsers that the content is a string and not XML; this prevents the parser from trying to interpret the Python code as XML, or the addition of @@ -594,11 +595,11 @@ sandboxed environment. This environment contains several utilities to help you interact with the Odoo database: -- ``self``: the record on which the action is executed - ``env``: the environment of the record - ``model``: the model of the record - ``user`` and ``uid``: the current user and their id -- ``datetime``, ``dateutil``, ``timezone`` and ``time``: libraries to help with date/time calculations +- ``datetime``, ``dateutil``, ``timezone`` and ``time``: libraries to help with date/time + calculations - ``float_compare``: a utility function to compare two float values with a given precision - ``b64encode`` and ``b64decode``: utility functions to encode and decode values in base64 - ``Command``: a utility class to help build complex expressions and commands (see the `Command`