Recordsets implement the active record pattern. This means that we can assign values on them, and these changes will be made persistent in the database. This is an intuitive and convenient way to manipulate data, as shown here:
>>> admin = self.env['res.users'].browse(1) >>> print admin.name Administrator >>> admin.name = 'Superuser' >>> print admin.name Superuser
Recordsets also have three methods to act on their data: create(), write(), and unlink().
The create() method takes a dictionary to map fields to values and returns the created record. Default values are automatically applied as expected, which is shown here:
>>> Partner = self.env['res.partner'] >>> new = Partner.create({'name': 'ACME', 'is_company': True}) >>> ...