This branch is the combination of several optimizations in the ORM: * store field values once in the cache: the cache reflects more faithfully the database, only fields that explicitly depend on the context have an extra indirection in the cache; * delay recomputations by default: use method `recompute` to explicitly flush out pending recomputations; * delay updates in method `write`: updates are stored in a data structure that can be flushed efficiently to the database with method `flush` (which also flush out recomputations); * make method `modified` take advantage of inverse fields to inverse dependencies; * filter records by evaluating a domain on records in Python; * a computed field with `readonly=False` behaves like a normal field with an onchange method; * computed fields are computed in superuser mode by default. Work done by Toufik Ben Jaa, Raphael Collet, Denis Ledoux and Fabien Pinckaers. closes odoo/odoo#35659 Signed-off-by: Denis Ledoux <beledouxdenis@users.noreply.github.com>
29 lines
998 B
Python
29 lines
998 B
Python
# -*- coding: utf-8 -*-
|
|
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
|
|
|
from odoo.tests import common
|
|
|
|
|
|
class TestBasic(common.TransactionCase):
|
|
def test_assertRecordValues(self):
|
|
X1 = {'f1': "X", 'f2': 1}
|
|
Y2 = {'f1': "Y", 'f2': 2}
|
|
Y3 = {'f1': "Y", 'f2': 3}
|
|
records = self.env['test_testing_utilities.a'].create([X1, Y2])
|
|
|
|
# match in any order
|
|
self.assertRecordValues(records, [X1, Y2])
|
|
self.assertRecordValues(records, [Y2, X1])
|
|
|
|
# fail if wrong size
|
|
with self.assertRaises(AssertionError):
|
|
self.assertRecordValues(records, [X1])
|
|
with self.assertRaises(AssertionError):
|
|
self.assertRecordValues(records, [X1, Y2, Y3])
|
|
|
|
# fail if fields don't match
|
|
with self.assertRaises(AssertionError):
|
|
self.assertRecordValues(records, [X1, Y3])
|
|
with self.assertRaises(AssertionError):
|
|
self.assertRecordValues(records, [Y3, X1])
|