diff options
| author | Raphael Collet <rco@odoo.com> | 2019-11-26 16:04:02 +0000 |
|---|---|---|
| committer | Raphael Collet <rco@odoo.com> | 2020-02-05 13:50:23 +0000 |
| commit | 058cf208a8e7d43ebfc2e761ec1cbfc6e7a56351 (patch) | |
| tree | 198230b33ca755e3b511b6618e673b1d9e27012f /odoo/tests | |
| parent | 840bd42718c940bf13d835e7f1fb298f3db370d9 (diff) | |
[ADD] sql_db: pre/post-commit/rollback hooks
Diffstat (limited to 'odoo/tests')
| -rw-r--r-- | odoo/tests/common.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/odoo/tests/common.py b/odoo/tests/common.py index 87a7889e4ec..c72832b4ad0 100644 --- a/odoo/tests/common.py +++ b/odoo/tests/common.py @@ -382,10 +382,12 @@ class BaseCase(TreeCase, MetaCase('DummyCase', (object,), {})): expected = counters.get(login, default) if flush: self.env.user.flush() + self.env.cr.precommit() count0 = self.cr.sql_log_count yield if flush: self.env.user.flush() + self.env.cr.precommit() count = self.cr.sql_log_count - count0 if count != expected: # add some info on caller to allow semi-automatic update of query count @@ -404,9 +406,11 @@ class BaseCase(TreeCase, MetaCase('DummyCase', (object,), {})): # same operations, otherwise the caches might not be ready! if flush: self.env.user.flush() + self.env.cr.precommit() yield if flush: self.env.user.flush() + self.env.cr.precommit() def assertRecordValues(self, records, expected_values): ''' Compare a recordset with a list of dictionaries representing the expected results. |
