From b404ae6a558108ec08a4da9d59072c53fc9ce1a1 Mon Sep 17 00:00:00 2001 From: Nicolas Seinlet Date: Tue, 23 Feb 2021 13:34:04 +0000 Subject: [PATCH] [FIX] registry: avoid dropping indexes When an index has name 'tablename_fieldname_index', this index is dropped if the field has index=False. This lead to dropping a user-created index or dropping/recreating the index when index=True is set in a dependent module. Some info is logged instead. closes odoo/odoo#67602 X-original-commit: 6a87318df296a11e3300723ca0c8b49c0dcf5fa7 Signed-off-by: Raphael Collet (rco) --- odoo/modules/registry.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/odoo/modules/registry.py b/odoo/modules/registry.py index fdcacab7c32..e794abfd053 100644 --- a/odoo/modules/registry.py +++ b/odoo/modules/registry.py @@ -452,7 +452,7 @@ class Registry(Mapping): except psycopg2.OperationalError: _schema.error("Unable to add index for %s", self) elif not index and indexname in existing: - sql.drop_index(cr, indexname, tablename) + _schema.info("Keep unexpected index %s on table %s", indexname, tablename) def add_foreign_key(self, table1, column1, table2, column2, ondelete, model, module, force=True):