From eaddb7caff0dbf55ade04e3c67e47f41cac67dc4 Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Mon, 6 Mar 2017 12:56:18 +0100 Subject: [PATCH] [FIX] uninstall: unlink of many2one fields having one2many dependencies The revision ea9ef7c39d3113b42de626e943425f7d63312c2f introduced a regression: many2one fields having one2many depending on it declared before the declaration of the many2one itself were not unlinked during a module uninstall. As a result, the column in the table was not dropped, and the table itself was not deleted either, not even truncated. Therefore, when you tried to reinstall the module, you had data left. The check of the one2many dependencies must not be performed during an uninstall. Anyway, this wasn't blocking the uninstall of the modules, it was just preventing the field to be deleted, that's all. opw-710291 --- openerp/addons/base/ir/ir_model.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/openerp/addons/base/ir/ir_model.py b/openerp/addons/base/ir/ir_model.py index e9479a67345..40b1626034d 100644 --- a/openerp/addons/base/ir/ir_model.py +++ b/openerp/addons/base/ir/ir_model.py @@ -141,10 +141,8 @@ class ir_model(osv.osv): for model in self.browse(cr, user, ids, context): if model.state != 'manual': raise UserError(_("Model '%s' contains module data and cannot be removed!") % (model.name,)) - - # prevent screwing up fields that depend on these models' fields - for model in self.browse(cr, user, ids, context=context): - model.field_id._prepare_update() + # prevent screwing up fields that depend on these models' fields + model.field_id._prepare_update() self._drop_table(cr, user, ids, context) res = super(ir_model, self).unlink(cr, user, ids, context)