From 2f1b15d982f774e826b5f6ac243cd1d9f2a32060 Mon Sep 17 00:00:00 2001 From: Victor Feyens Date: Wed, 1 Dec 2021 14:32:06 +0000 Subject: [PATCH] [FIX] core: in _auto_init, only log computation message if table is not empty closes odoo/odoo#80687 Signed-off-by: Raphael Collet (rco) --- odoo/models.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/odoo/models.py b/odoo/models.py index c94cb0deee5..b2be9d6a274 100644 --- a/odoo/models.py +++ b/odoo/models.py @@ -2848,9 +2848,10 @@ class BaseModel(metaclass=MetaModel): # added to the database cr.execute('SELECT id FROM "{}"'.format(self._table)) records = self.browse(row[0] for row in cr.fetchall()) - for field in fields_to_compute: - _logger.info("Prepare computation of %s", field) - self.env.add_to_compute(field, records) + if records: + for field in fields_to_compute: + _logger.info("Prepare computation of %s", field) + self.env.add_to_compute(field, records) if self._auto: self._add_sql_constraints()