Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ addon | version | maintainers | summary
[base_view_inheritance_extension](base_view_inheritance_extension/) | 19.0.1.0.0 | <a href='https://github.com/hbrunn'><img src='https://github.com/hbrunn.png' width='32' height='32' style='border-radius:50%;' alt='hbrunn'/></a> | Adds more operators for view inheritance
[base_write_diff](base_write_diff/) | 19.0.1.0.0 | | Prevents updates on fields whose values won't change anyway
[bus_alt_connection](bus_alt_connection/) | 19.0.1.0.0 | | Needed when using PgBouncer as a connection pooler
[database_cleanup](database_cleanup/) | 19.0.1.0.3 | | Database cleanup
[database_cleanup](database_cleanup/) | 19.0.1.0.6 | | Database cleanup
[dbfilter_from_header](dbfilter_from_header/) | 19.0.1.0.0 | | Filter databases with HTTP headers
[field_vector](field_vector/) | 19.0.1.0.0 | <a href='https://github.com/lmignon'><img src='https://github.com/lmignon.png' width='32' height='32' style='border-radius:50%;' alt='lmignon'/></a> | New specialized field to store vector data
[iap_alternative_provider](iap_alternative_provider/) | 19.0.1.0.0 | <a href='https://github.com/sebastienbeau'><img src='https://github.com/sebastienbeau.png' width='32' height='32' style='border-radius:50%;' alt='sebastienbeau'/></a> | Base module for providing alternative provider for iap apps
Expand Down
2 changes: 1 addition & 1 deletion database_cleanup/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Database cleanup
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:d03832b90bf6fd35cdb5112468c09e27bbdee9d3aa1a3a422b9423750f4cf990
!! source digest: sha256:34dd0f034d406539b5c0f25bc8a0b60b58acf39d61e17ec5f687b312f534d234
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
Expand Down
2 changes: 1 addition & 1 deletion database_cleanup/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
"name": "Database cleanup",
"version": "19.0.1.0.3",
"version": "19.0.1.0.6",
"author": "Therp BV,Odoo Community Association (OCA)",
"website": "https://github.com/OCA/server-tools",
"depends": ["base"],
Expand Down
2 changes: 1 addition & 1 deletion database_cleanup/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ <h1>Database cleanup</h1>
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:d03832b90bf6fd35cdb5112468c09e27bbdee9d3aa1a3a422b9423750f4cf990
!! source digest: sha256:34dd0f034d406539b5c0f25bc8a0b60b58acf39d61e17ec5f687b312f534d234
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/license-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/server-tools/tree/19.0/database_cleanup"><img alt="OCA/server-tools" src="https://img.shields.io/badge/github-OCA%2Fserver--tools-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/server-tools-19-0/server-tools-19-0-database_cleanup"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/server-tools&amp;target_branch=19.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>Clean your Odoo database from remnants of modules, models, columns and
Expand Down
5 changes: 1 addition & 4 deletions database_cleanup/wizards/purge_line_modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,7 @@ def purge(self):
return True
self.logger.info("Purging modules %s", ", ".join(module_names))
installed = modules.filtered(lambda x: x.state in ("installed", "to upgrade"))
to_remove = modules - installed
to_remove += to_remove.downstream_dependencies()
to_remove.write({"state": "to remove"})
installed.button_immediate_uninstall()
installed.module_uninstall()
with self.env.registry.cursor() as new_cr:
self.env(cr=new_cr)["ir.module.module"].browse(modules.ids).unlink()
return self.write({"purged": True})
17 changes: 7 additions & 10 deletions database_cleanup/wizards/purge_menus.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
# pylint: disable=consider-merging-classes-inherited
from odoo import api, fields, models
from odoo.exceptions import UserError
from odoo.fields import Command


class CleanupPurgeWizardMenu(models.TransientModel):
Expand All @@ -22,19 +23,15 @@ def find(self):
.with_context(active_test=False)
.search([("action", "!=", False)])
):
command = Command.create({"name": menu.complete_name, "menu_id": menu.id})
if not menu.action.exists():
# Menus may have actions that do not exist or have been deleted
res.append(command)
continue
if menu.action.type != "ir.actions.act_window":
continue
if menu.action.res_model and menu.action.res_model not in self.env:
res.append(
(
0,
0,
{
"name": menu.complete_name,
"menu_id": menu.id,
},
)
)
res.append(command)
if not res:
raise UserError(self.env._("No dangling menu entries found"))
return res
Expand Down
9 changes: 9 additions & 0 deletions database_cleanup/wizards/purge_tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,15 @@ class CleanupPurgeWizardTable(models.TransientModel):
_description = "Purge tables"
blacklist = [
"endpoint_route", # web-api/endpoint_route_handler
# \/\/ from Registry.setup_signaling() \/\/
"orm_signaling_assets",
"orm_signaling_default",
"orm_signaling_groups",
"orm_signaling_registry",
"orm_signaling_routing",
"orm_signaling_stable",
"orm_signaling_templates",
# /\/\ from Registry.setup_signaling() /\/\
]

@api.model
Expand Down
Loading