From 8cf5fb7777cdb9d3c649d492d22b9ea2d3a5556a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miquel=20Ra=C3=AFch?= <miquel.raich@forgeflow.com> Date: Tue, 12 Sep 2023 10:26:51 +0200 Subject: [PATCH] [IMP] models: only log "long name constraint" when the constraint is added MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This way, we avoid spamming the log each time new constraints are added in the constraint's table. closes odoo/odoo#135123 Signed-off-by: Rémy Voet (ryv) <ryv@odoo.com> --- odoo/models.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/odoo/models.py b/odoo/models.py index ca7e3dfb9c39..3cf48ae42eec 100644 --- a/odoo/models.py +++ b/odoo/models.py @@ -2654,10 +2654,9 @@ class BaseModel(MetaModel('DummyModel', (object,), {'_register': False})): for (key, definition, message) in self._sql_constraints: conname = '%s_%s' % (self._table, key) - if len(conname) > 63: - _logger.info("Constraint name %r has more than 63 characters", conname) - current_definition = tools.constraint_definition(cr, self._table, conname) + if len(conname) > 63 and not current_definition: + _logger.info("Constraint name %r has more than 63 characters", conname) if current_definition == definition: continue -- GitLab