|
@ -3,7 +3,6 @@ |
|
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). |
|
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). |
|
|
from odoo import _, api, fields, models |
|
|
from odoo import _, api, fields, models |
|
|
from odoo.exceptions import UserError |
|
|
from odoo.exceptions import UserError |
|
|
from odoo.modules.registry import RegistryManager |
|
|
|
|
|
from odoo.modules.module import get_module_path |
|
|
from odoo.modules.module import get_module_path |
|
|
from odoo.addons.base.ir.ir_model import MODULE_UNINSTALL_FLAG |
|
|
from odoo.addons.base.ir.ir_model import MODULE_UNINSTALL_FLAG |
|
|
|
|
|
|
|
@ -53,11 +52,9 @@ class CleanupPurgeLineModule(models.TransientModel): |
|
|
if not modules: |
|
|
if not modules: |
|
|
return True |
|
|
return True |
|
|
self.logger.info('Purging modules %s', ', '.join(module_names)) |
|
|
self.logger.info('Purging modules %s', ', '.join(module_names)) |
|
|
modules.button_immediate_uninstall() |
|
|
|
|
|
# we need this commit because reloading the registry would roll back |
|
|
|
|
|
# our changes |
|
|
|
|
|
self.env.cr.commit() # pylint: disable=invalid-commit |
|
|
|
|
|
RegistryManager.new(self.env.cr.dbname, update_module=True) |
|
|
|
|
|
|
|
|
modules.filtered( |
|
|
|
|
|
lambda x: x.state not in ('uninstallable', 'uninstalled') |
|
|
|
|
|
).button_immediate_uninstall() |
|
|
modules.refresh() |
|
|
modules.refresh() |
|
|
modules.unlink() |
|
|
modules.unlink() |
|
|
return objs.write({'purged': True}) |
|
|
return objs.write({'purged': True}) |
|
|