Note Because the record rules and access control will have to be re-evaluated, the new recordset will not benefit from the current environment's data cache, so later data access may incur extra delays while re-fetching from the database. The returned value is a dictionary (indiced by field name) of dictionaries. The string, help, and selection (if present) attributes are translated.
In the "traditional" style, parameters like the database cursor, user id, context dictionary and record ids (usually denoted as In the form views where the field appears, the method will be called when one of the given fields is modified.
The method is invoked on a pseudo-record that contains the values present in the form.
Field assignments on that record are automatically sent back to the client.
This page documents the New API added in Odoo 8.0 which should be the primary development API going forward.
It also provides information about porting from or bridging with the "old API" of versions 7 and earlier, but does not explicitly document that API. Recordsets provide an "Active Record" interface: model fields can be read and written directly from the record, but only on singletons (single-record recordsets).
Setting a field's value triggers an update to the database: stores various contextual data used by the ORM: the database cursor (for database queries), the current user (for access rights checking) and the current context (storing arbitrary metadata). All recordsets have an environment, which is immutable, can be accessed using creates a new environment with the provided user set, uses the administrator if none is provided (to bypass access rights/rules in safe contexts), returns a copy of the recordset it is called on using the new environment: When a user changes a field's value in a form (but hasn't saved the form yet), it can be useful to automatically update other fields based on that value e.g.updating a final total when the tax is changed or a new invoice line is added.attribute on environments is the cursor for the current database transaction and allows executing SQL directly, either for queries which are difficult to express using the ORM (e.g.complex joins) or for performance reasons: Tipcalls from the new API to the old API are bridgedwhen using the new API style, calls to methods defined using the old API are automatically converted on-the-fly, there should be no need to do anything special: Note Using [UNKNOWN NODE title_reference] could cause data access to cross the boundaries of record rules, possibly mixing records that are meant to be isolated (e.g.records from different companies in multi-company environments).It may lead to un-intuitive results in methods which select one record among many - for example getting the default company, or selecting a Bill of Materials.