[IMP] models: only log "long name constraint" when the constraint is added
This way, we avoid spamming the log each time new constraints are added in the constraint's table. closes odoo/odoo#132681 Signed-off-by: Rémy Voet (ryv) <ryv@odoo.com>
This commit is contained in:
+5
-3
@@ -3109,10 +3109,12 @@ class BaseModel(metaclass=MetaModel):
|
||||
conname = '%s_%s' % (self._table, key)
|
||||
if len(conname) > 63:
|
||||
hashed_conname = tools.make_identifier(conname)
|
||||
_logger.info("Constraint name %r has more than 63 characters, internal PG identifier is %r", conname, hashed_conname)
|
||||
current_definition = tools.constraint_definition(cr, self._table, hashed_conname)
|
||||
if not current_definition:
|
||||
_logger.info("Constraint name %r has more than 63 characters, internal PG identifier is %r", conname, hashed_conname)
|
||||
conname = hashed_conname
|
||||
|
||||
current_definition = tools.constraint_definition(cr, self._table, conname)
|
||||
else:
|
||||
current_definition = tools.constraint_definition(cr, self._table, conname)
|
||||
if current_definition == definition:
|
||||
continue
|
||||
|
||||
|
||||
Reference in New Issue
Block a user