[FIX] base: avoid recursion depth errors during uninstall
For some reason _logger.info with exc_info=True inside a recursive function generates RecursionErrors, presumably because the logger uses recursion itself to generate the stack trace that is logged. A simple solution would be to remove exc_info=True, but I've decided to move the log out of the delete function and simply call it once per uninstall process with all undeletable IDs, so it's kind of a fix + optimization. closes odoo/odoo#75445 X-original-commit: 3a04de569bca10a1d1a01f719635de6842e747b2 Signed-off-by: Raphael Collet (rco) <rco@openerp.com> Signed-off-by: Adrian Torres (adt) <adt@odoo.com> Co-authored-by: Raphael Collet <rco@odoo.com>
This commit is contained in:
co-authored by
Raphael Collet
parent
8f7b965446
commit
d543f53c33
@@ -2130,7 +2130,6 @@ class IrModelData(models.Model):
|
||||
records.unlink()
|
||||
except Exception:
|
||||
if len(records) <= 1:
|
||||
_logger.info('Unable to delete %s', records, exc_info=True)
|
||||
undeletable_ids.extend(ref_data._ids)
|
||||
else:
|
||||
# divide the batch in two, and recursively delete them
|
||||
@@ -2167,6 +2166,9 @@ class IrModelData(models.Model):
|
||||
# remove models
|
||||
delete(self.env['ir.model'].browse(unique(model_ids)))
|
||||
|
||||
# log undeletable ids
|
||||
_logger.info("ir.model.data could not be deleted (%s)", undeletable_ids)
|
||||
|
||||
# sort out which undeletable model data may have become deletable again because
|
||||
# of records being cascade-deleted or tables being dropped just above
|
||||
for data in self.browse(undeletable_ids).exists():
|
||||
|
||||
Reference in New Issue
Block a user