diff options
| author | Raphael Collet <rco@odoo.com> | 2020-09-16 11:04:56 +0000 |
|---|---|---|
| committer | Raphael Collet <rco@odoo.com> | 2020-09-28 11:31:09 +0000 |
| commit | 3bc0acea0ce961c02f0d4f95da3b45875d0d2216 (patch) | |
| tree | b3d961731edb428471c8307564a62da6241eb669 /odoo | |
| parent | 7f1e46331aecdaa4e08828240a495923c251c69f (diff) | |
[FIX] core: small optimization in first computation of records
X-original-commit: 99f765139076671ecba3b49359652e7333a90e17
Diffstat (limited to 'odoo')
| -rw-r--r-- | odoo/models.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/odoo/models.py b/odoo/models.py index a965e61dd43..6c23cad4c00 100644 --- a/odoo/models.py +++ b/odoo/models.py @@ -2568,9 +2568,11 @@ class BaseModel(MetaModel('DummyModel', (object,), {'_register': False})): if fields_to_compute: @self.pool.post_init def mark_fields_to_compute(): - recs = self.with_context(active_test=False).search([]) + recs = self.with_context(active_test=False).search([], order='id') + if not recs: + return for field in fields_to_compute: - _logger.info("Storing computed values of %s", field) + _logger.info("Storing computed values of %s.%s", recs._name, field) self.env.add_to_compute(recs._fields[field], recs) if self._auto: |
