Browse Source

[MIG] database_cleanup: Migration to version 10.0

Using new base model inheritance.
pull/894/head
Eric Antones 8 years ago
committed by Emanuel Cino
parent
commit
bf40673c9a
  1. 6
      .travis.yml
  2. 8
      database_cleanup/README.rst
  3. 4
      database_cleanup/__manifest__.py
  4. 2
      database_cleanup/i18n/am.po
  5. 147
      database_cleanup/i18n/ca.po
  6. 2
      database_cleanup/i18n/database_cleanup.pot
  7. 2
      database_cleanup/i18n/de.po
  8. 2
      database_cleanup/i18n/el_GR.po
  9. 2
      database_cleanup/i18n/es.po
  10. 2
      database_cleanup/i18n/es_ES.po
  11. 2
      database_cleanup/i18n/fi.po
  12. 2
      database_cleanup/i18n/fr.po
  13. 2
      database_cleanup/i18n/fr_CA.po
  14. 2
      database_cleanup/i18n/gl.po
  15. 2
      database_cleanup/i18n/hr.po
  16. 2
      database_cleanup/i18n/hr_HR.po
  17. 2
      database_cleanup/i18n/it.po
  18. 2
      database_cleanup/i18n/nl.po
  19. 2
      database_cleanup/i18n/pt.po
  20. 2
      database_cleanup/i18n/pt_BR.po
  21. 2
      database_cleanup/i18n/pt_PT.po
  22. 2
      database_cleanup/i18n/ru.po
  23. 2
      database_cleanup/i18n/sl.po
  24. 2
      database_cleanup/i18n/tr.po
  25. 2
      database_cleanup/i18n/zh_CN.po
  26. 8
      database_cleanup/models/create_indexes.py
  27. 19
      database_cleanup/models/purge_columns.py
  28. 13
      database_cleanup/models/purge_data.py
  29. 16
      database_cleanup/models/purge_menus.py
  30. 49
      database_cleanup/models/purge_models.py
  31. 19
      database_cleanup/models/purge_modules.py
  32. 6
      database_cleanup/models/purge_properties.py
  33. 22
      database_cleanup/models/purge_tables.py
  34. 6
      database_cleanup/models/purge_wizard.py
  35. 32
      database_cleanup/tests/test_database_cleanup.py
  36. 4
      database_cleanup/views/create_indexes.xml
  37. 118
      database_cleanup/views/menu.xml
  38. 88
      database_cleanup/views/purge_columns.xml
  39. 88
      database_cleanup/views/purge_data.xml
  40. 85
      database_cleanup/views/purge_menus.xml
  41. 85
      database_cleanup/views/purge_models.xml
  42. 85
      database_cleanup/views/purge_modules.xml
  43. 82
      database_cleanup/views/purge_properties.xml
  44. 84
      database_cleanup/views/purge_tables.xml
  45. 84
      database_cleanup/views/purge_wizard.xml

6
.travis.yml

@ -23,8 +23,10 @@ env:
matrix: matrix:
- LINT_CHECK="1" - LINT_CHECK="1"
- TRANSIFEX="1" - TRANSIFEX="1"
- TESTS="1" ODOO_REPO="odoo/odoo"
- TESTS="1" ODOO_REPO="OCA/OCB"
- TESTS="1" ODOO_REPO="odoo/odoo" EXCLUDE="database_cleanup"
- TESTS="1" ODOO_REPO="OCA/OCB" EXCLUDE="database_cleanup"
- TESTS="1" ODOO_REPO="odoo/odoo" INCLUDE="database_cleanup"
- TESTS="1" ODOO_REPO="OCA/OCB" INCLUDE="database_cleanup"
virtualenv: virtualenv:
system_site_packages: true system_site_packages: true

8
database_cleanup/README.rst

@ -6,13 +6,13 @@
Database cleanup Database cleanup
================ ================
Clean your OpenERP database from remnants of modules, models, columns and
Clean your Odoo database from remnants of modules, models, columns and
tables left by uninstalled modules (prior to 7.0) or a homebrew database tables left by uninstalled modules (prior to 7.0) or a homebrew database
upgrade to a new major version of OpenERP.
upgrade to a new major version of Odoo.
Caution! This module is potentially harmful and can *easily* destroy the Caution! This module is potentially harmful and can *easily* destroy the
integrity of your data. Do not use if you are not entirely comfortable integrity of your data. Do not use if you are not entirely comfortable
with the technical details of the OpenERP data model of *all* the modules
with the technical details of the Odoo data model of *all* the modules
that have ever been installed on your database, and do not purge any module, that have ever been installed on your database, and do not purge any module,
model, column or table if you do not know exactly what you are doing. model, column or table if you do not know exactly what you are doing.
@ -28,7 +28,7 @@ in one big step (if you are *really* confident).
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas .. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot :alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/149/9.0
:target: https://runbot.odoo-community.org/runbot/149/10.0
Bug Tracker Bug Tracker
=========== ===========

4
database_cleanup/__manifest__.py

@ -3,7 +3,7 @@
# 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).
{ {
'name': 'Database cleanup', 'name': 'Database cleanup',
'version': '9.0.1.0.0',
'version': '10.0.1.0.0',
'author': "Therp BV,Odoo Community Association (OCA)", 'author': "Therp BV,Odoo Community Association (OCA)",
'depends': ['base'], 'depends': ['base'],
'license': 'AGPL-3', 'license': 'AGPL-3',
@ -20,5 +20,5 @@
'views/purge_properties.xml', 'views/purge_properties.xml',
'views/menu.xml', 'views/menu.xml',
], ],
'installable': False,
'installable': True,
} }

2
database_cleanup/i18n/am.po

@ -6,7 +6,7 @@
# OCA Transbot <transbot@odoo-community.org>, 2016 # OCA Transbot <transbot@odoo-community.org>, 2016
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Odoo Server 9.0c\n"
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-04-19 18:00+0000\n" "POT-Creation-Date: 2017-04-19 18:00+0000\n"
"PO-Revision-Date: 2017-04-19 18:00+0000\n" "PO-Revision-Date: 2017-04-19 18:00+0000\n"

147
database_cleanup/i18n/ca.po

@ -1,4 +1,3 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules: # This file contains the translation of the following modules:
# * database_cleanup # * database_cleanup
# #
@ -7,7 +6,7 @@
# Marc Tormo i Bochaca <mtbochaca@gmail.com>, 2017 # Marc Tormo i Bochaca <mtbochaca@gmail.com>, 2017
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Odoo Server 9.0c\n"
"Project-Id-Version: Odoo Server 10.0c\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-04-19 18:00+0000\n" "POT-Creation-Date: 2017-04-19 18:00+0000\n"
"PO-Revision-Date: 2017-04-19 18:00+0000\n" "PO-Revision-Date: 2017-04-19 18:00+0000\n"
@ -22,7 +21,7 @@ msgstr ""
#. module: database_cleanup #. module: database_cleanup
#: model:ir.model.fields,field_description:database_cleanup.field_cleanup_purge_wizard_column_purge_line_ids #: model:ir.model.fields,field_description:database_cleanup.field_cleanup_purge_wizard_column_purge_line_ids
msgid "Columns to purge" msgid "Columns to purge"
msgstr ""
msgstr "Columnes a purgar"
#. module: database_cleanup #. module: database_cleanup
#: model:ir.actions.server,name:database_cleanup.cleanup_create_indexes_line_action #: model:ir.actions.server,name:database_cleanup.cleanup_create_indexes_line_action
@ -99,17 +98,17 @@ msgstr "Creat el"
#. module: database_cleanup #. module: database_cleanup
#: model:ir.model.fields,field_description:database_cleanup.field_cleanup_purge_line_data_data_id #: model:ir.model.fields,field_description:database_cleanup.field_cleanup_purge_line_data_data_id
msgid "Data entry" msgid "Data entry"
msgstr ""
msgstr "Entrada de dades"
#. module: database_cleanup #. module: database_cleanup
#: model:ir.model.fields,field_description:database_cleanup.field_cleanup_purge_wizard_data_purge_line_ids #: model:ir.model.fields,field_description:database_cleanup.field_cleanup_purge_wizard_data_purge_line_ids
msgid "Data to purge" msgid "Data to purge"
msgstr ""
msgstr "Dades a purgar"
#. module: database_cleanup #. module: database_cleanup
#: model:ir.ui.menu,name:database_cleanup.menu_database_cleanup #: model:ir.ui.menu,name:database_cleanup.menu_database_cleanup
msgid "Database cleanup" msgid "Database cleanup"
msgstr ""
msgstr "Neteja de la base de dades"
#. module: database_cleanup #. module: database_cleanup
#: model:ir.model.fields,field_description:database_cleanup.field_cleanup_create_indexes_line_display_name #: model:ir.model.fields,field_description:database_cleanup.field_cleanup_create_indexes_line_display_name
@ -131,12 +130,7 @@ msgstr ""
#: model:ir.model.fields,field_description:database_cleanup.field_cleanup_purge_wizard_property_display_name #: model:ir.model.fields,field_description:database_cleanup.field_cleanup_purge_wizard_property_display_name
#: model:ir.model.fields,field_description:database_cleanup.field_cleanup_purge_wizard_table_display_name #: model:ir.model.fields,field_description:database_cleanup.field_cleanup_purge_wizard_table_display_name
msgid "Display Name" msgid "Display Name"
msgstr "Veure el nom"
#. module: database_cleanup
#: selection:cleanup.purge.line.property,reason:0
msgid "Duplicated property"
msgstr ""
msgstr "Nom a mostrar"
#. module: database_cleanup #. module: database_cleanup
#: model:ir.model.fields,field_description:database_cleanup.field_cleanup_create_indexes_line_field_id #: model:ir.model.fields,field_description:database_cleanup.field_cleanup_create_indexes_line_field_id
@ -235,32 +229,32 @@ msgstr "Darrera Actualització el"
#. module: database_cleanup #. module: database_cleanup
#: model:ir.model.fields,field_description:database_cleanup.field_cleanup_purge_line_menu_menu_id #: model:ir.model.fields,field_description:database_cleanup.field_cleanup_purge_line_menu_menu_id
msgid "Menu entry" msgid "Menu entry"
msgstr ""
msgstr "Entrada de menú"
#. module: database_cleanup #. module: database_cleanup
#: model:ir.model.fields,field_description:database_cleanup.field_cleanup_purge_wizard_menu_purge_line_ids #: model:ir.model.fields,field_description:database_cleanup.field_cleanup_purge_wizard_menu_purge_line_ids
msgid "Menus to purge" msgid "Menus to purge"
msgstr ""
msgstr "Menús a purgar"
#. module: database_cleanup #. module: database_cleanup
#: model:ir.model.fields,field_description:database_cleanup.field_cleanup_purge_line_column_model_id #: model:ir.model.fields,field_description:database_cleanup.field_cleanup_purge_line_column_model_id
msgid "Model" msgid "Model"
msgstr ""
msgstr "Model"
#. module: database_cleanup #. module: database_cleanup
#: model:ir.model,name:database_cleanup.model_ir_model #: model:ir.model,name:database_cleanup.model_ir_model
msgid "Models" msgid "Models"
msgstr "Models "
msgstr "Models"
#. module: database_cleanup #. module: database_cleanup
#: model:ir.model.fields,field_description:database_cleanup.field_cleanup_purge_wizard_model_purge_line_ids #: model:ir.model.fields,field_description:database_cleanup.field_cleanup_purge_wizard_model_purge_line_ids
msgid "Models to purge" msgid "Models to purge"
msgstr ""
msgstr "Models a purgar"
#. module: database_cleanup #. module: database_cleanup
#: model:ir.model.fields,field_description:database_cleanup.field_cleanup_purge_wizard_module_purge_line_ids #: model:ir.model.fields,field_description:database_cleanup.field_cleanup_purge_wizard_module_purge_line_ids
msgid "Modules to purge" msgid "Modules to purge"
msgstr ""
msgstr "Mòduls a purgar"
#. module: database_cleanup #. module: database_cleanup
#: model:ir.model.fields,field_description:database_cleanup.field_cleanup_create_indexes_line_name #: model:ir.model.fields,field_description:database_cleanup.field_cleanup_create_indexes_line_name
@ -279,37 +273,37 @@ msgstr "Nom"
#: code:addons/database_cleanup/models/purge_menus.py:46 #: code:addons/database_cleanup/models/purge_menus.py:46
#, python-format #, python-format
msgid "No dangling menu entries found" msgid "No dangling menu entries found"
msgstr ""
msgstr "No s'han trobat entrades de menú penjades"
#. module: database_cleanup #. module: database_cleanup
#: code:addons/database_cleanup/models/purge_modules.py:79 #: code:addons/database_cleanup/models/purge_modules.py:79
#, python-format #, python-format
msgid "No modules found to purge" msgid "No modules found to purge"
msgstr ""
msgstr "No s'han trobat mòduls per purgar"
#. module: database_cleanup #. module: database_cleanup
#: code:addons/database_cleanup/models/purge_columns.py:123 #: code:addons/database_cleanup/models/purge_columns.py:123
#, python-format #, python-format
msgid "No orphaned columns found" msgid "No orphaned columns found"
msgstr ""
msgstr "No s'han trobat columnes orfes"
#. module: database_cleanup #. module: database_cleanup
#: code:addons/database_cleanup/models/purge_data.py:64 #: code:addons/database_cleanup/models/purge_data.py:64
#, python-format #, python-format
msgid "No orphaned data entries found" msgid "No orphaned data entries found"
msgstr ""
msgstr "No s'han trobat entrades de dades orfes"
#. module: database_cleanup #. module: database_cleanup
#: code:addons/database_cleanup/models/purge_models.py:116 #: code:addons/database_cleanup/models/purge_models.py:116
#, python-format #, python-format
msgid "No orphaned models found" msgid "No orphaned models found"
msgstr ""
msgstr "No s'han trobat models orfes"
#. module: database_cleanup #. module: database_cleanup
#: code:addons/database_cleanup/models/purge_tables.py:102 #: code:addons/database_cleanup/models/purge_tables.py:102
#, python-format #, python-format
msgid "No orphaned tables found" msgid "No orphaned tables found"
msgstr ""
msgstr "No s'han trobat taules orfes"
#. module: database_cleanup #. module: database_cleanup
#: model:ir.ui.view,arch_db:database_cleanup.form_purge_wizard #: model:ir.ui.view,arch_db:database_cleanup.form_purge_wizard
@ -336,7 +330,7 @@ msgstr ""
#: model:ir.actions.server,name:database_cleanup.action_purge_table_line #: model:ir.actions.server,name:database_cleanup.action_purge_table_line
#: model:ir.ui.view,arch_db:database_cleanup.form_purge_wizard #: model:ir.ui.view,arch_db:database_cleanup.form_purge_wizard
msgid "Purge" msgid "Purge"
msgstr ""
msgstr "Purgar"
#. module: database_cleanup #. module: database_cleanup
#: model:ir.model.fields,field_description:database_cleanup.field_cleanup_purge_line_column_wizard_id #: model:ir.model.fields,field_description:database_cleanup.field_cleanup_purge_line_column_wizard_id
@ -347,40 +341,34 @@ msgstr ""
#: model:ir.model.fields,field_description:database_cleanup.field_cleanup_purge_line_property_wizard_id #: model:ir.model.fields,field_description:database_cleanup.field_cleanup_purge_line_property_wizard_id
#: model:ir.model.fields,field_description:database_cleanup.field_cleanup_purge_line_table_wizard_id #: model:ir.model.fields,field_description:database_cleanup.field_cleanup_purge_line_table_wizard_id
msgid "Purge Wizard" msgid "Purge Wizard"
msgstr ""
msgstr "Assistent de purga"
#. module: database_cleanup #. module: database_cleanup
#: model:ir.ui.view,arch_db:database_cleanup.form_purge_wizard #: model:ir.ui.view,arch_db:database_cleanup.form_purge_wizard
msgid "Purge all" msgid "Purge all"
msgstr ""
msgstr "Purgar tot"
#. module: database_cleanup #. module: database_cleanup
#: model:ir.actions.server,name:database_cleanup.action_purge_columns #: model:ir.actions.server,name:database_cleanup.action_purge_columns
#: model:ir.model,name:database_cleanup.model_cleanup_purge_wizard_column #: model:ir.model,name:database_cleanup.model_cleanup_purge_wizard_column
msgid "Purge columns" msgid "Purge columns"
msgstr ""
msgstr "Purgar columnes"
#. module: database_cleanup #. module: database_cleanup
#: model:ir.model,name:database_cleanup.model_cleanup_purge_wizard_data #: model:ir.model,name:database_cleanup.model_cleanup_purge_wizard_data
msgid "Purge data" msgid "Purge data"
msgstr ""
msgstr "Purgar dades"
#. module: database_cleanup #. module: database_cleanup
#: model:ir.actions.server,name:database_cleanup.action_purge_data #: model:ir.actions.server,name:database_cleanup.action_purge_data
msgid "Purge data entries that refer to missing resources" msgid "Purge data entries that refer to missing resources"
msgstr ""
#. module: database_cleanup
#: model:ir.model.fields,field_description:database_cleanup.field_cleanup_create_indexes_wizard_purge_line_ids
#: model:ir.model.fields,field_description:database_cleanup.field_cleanup_purge_wizard_purge_line_ids
msgid "Purge line ids"
msgstr ""
msgstr "Purgar entrades de dades que fan referència a recursos perduts"
#. module: database_cleanup #. module: database_cleanup
#: model:ir.actions.server,name:database_cleanup.action_purge_menus #: model:ir.actions.server,name:database_cleanup.action_purge_menus
#: model:ir.model,name:database_cleanup.model_cleanup_purge_wizard_menu #: model:ir.model,name:database_cleanup.model_cleanup_purge_wizard_menu
msgid "Purge menus" msgid "Purge menus"
msgstr ""
msgstr "Purgar menús"
#. module: database_cleanup #. module: database_cleanup
#: model:ir.actions.server,name:database_cleanup.action_purge_models #: model:ir.actions.server,name:database_cleanup.action_purge_models
@ -388,38 +376,38 @@ msgstr ""
#: model:ir.model,name:database_cleanup.model_cleanup_purge_wizard_model #: model:ir.model,name:database_cleanup.model_cleanup_purge_wizard_model
#: model:ir.ui.view,arch_db:database_cleanup.tree_purge_line #: model:ir.ui.view,arch_db:database_cleanup.tree_purge_line
msgid "Purge models" msgid "Purge models"
msgstr ""
msgstr "Purgar models"
#. module: database_cleanup #. module: database_cleanup
#: model:ir.actions.server,name:database_cleanup.action_purge_modules #: model:ir.actions.server,name:database_cleanup.action_purge_modules
#: model:ir.model,name:database_cleanup.model_cleanup_purge_wizard_module #: model:ir.model,name:database_cleanup.model_cleanup_purge_wizard_module
msgid "Purge modules" msgid "Purge modules"
msgstr ""
msgstr "Purgar mòduls"
#. module: database_cleanup #. module: database_cleanup
#: model:ir.ui.menu,name:database_cleanup.menu_purge_columns #: model:ir.ui.menu,name:database_cleanup.menu_purge_columns
msgid "Purge obsolete columns" msgid "Purge obsolete columns"
msgstr ""
msgstr "Purgar columnes obsoletes"
#. module: database_cleanup #. module: database_cleanup
#: model:ir.ui.menu,name:database_cleanup.menu_purge_data #: model:ir.ui.menu,name:database_cleanup.menu_purge_data
msgid "Purge obsolete data entries" msgid "Purge obsolete data entries"
msgstr ""
msgstr "Purgar entrades de dades obsoletes"
#. module: database_cleanup #. module: database_cleanup
#: model:ir.ui.menu,name:database_cleanup.menu_purge_menus #: model:ir.ui.menu,name:database_cleanup.menu_purge_menus
msgid "Purge obsolete menu entries" msgid "Purge obsolete menu entries"
msgstr ""
msgstr "Purgar entrades de menú obsoletes"
#. module: database_cleanup #. module: database_cleanup
#: model:ir.ui.menu,name:database_cleanup.menu_purge_models #: model:ir.ui.menu,name:database_cleanup.menu_purge_models
msgid "Purge obsolete models" msgid "Purge obsolete models"
msgstr ""
msgstr "Purgar models obsolets"
#. module: database_cleanup #. module: database_cleanup
#: model:ir.ui.menu,name:database_cleanup.menu_purge_modules #: model:ir.ui.menu,name:database_cleanup.menu_purge_modules
msgid "Purge obsolete modules" msgid "Purge obsolete modules"
msgstr ""
msgstr "Purgar mòduls obsolets"
#. module: database_cleanup #. module: database_cleanup
#: model:ir.ui.menu,name:database_cleanup.menu_purge_property #: model:ir.ui.menu,name:database_cleanup.menu_purge_property
@ -429,30 +417,18 @@ msgstr ""
#. module: database_cleanup #. module: database_cleanup
#: model:ir.ui.menu,name:database_cleanup.menu_purge_tables #: model:ir.ui.menu,name:database_cleanup.menu_purge_tables
msgid "Purge obsolete tables" msgid "Purge obsolete tables"
msgstr ""
#. module: database_cleanup
#: model:ir.actions.server,name:database_cleanup.action_purge_property
#: model:ir.model,name:database_cleanup.model_cleanup_purge_line_property
#: model:ir.model,name:database_cleanup.model_cleanup_purge_wizard_property
msgid "Purge properties"
msgstr ""
#. module: database_cleanup
#: model:ir.model,name:database_cleanup.model_cleanup_purge_wizard
msgid "Purge stuff"
msgstr ""
msgstr "Purgar taules obsoletes"
#. module: database_cleanup #. module: database_cleanup
#: model:ir.actions.server,name:database_cleanup.action_purge_tables #: model:ir.actions.server,name:database_cleanup.action_purge_tables
#: model:ir.model,name:database_cleanup.model_cleanup_purge_wizard_table #: model:ir.model,name:database_cleanup.model_cleanup_purge_wizard_table
msgid "Purge tables" msgid "Purge tables"
msgstr ""
msgstr "Purgar taules"
#. module: database_cleanup #. module: database_cleanup
#: model:ir.ui.view,arch_db:database_cleanup.tree_purge_line #: model:ir.ui.view,arch_db:database_cleanup.tree_purge_line
msgid "Purge this model" msgid "Purge this model"
msgstr ""
msgstr "Purgar aquest model"
#. module: database_cleanup #. module: database_cleanup
#: model:ir.model.fields,field_description:database_cleanup.field_cleanup_purge_line_column_purged #: model:ir.model.fields,field_description:database_cleanup.field_cleanup_purge_line_column_purged
@ -464,7 +440,7 @@ msgstr ""
#: model:ir.model.fields,field_description:database_cleanup.field_cleanup_purge_line_purged #: model:ir.model.fields,field_description:database_cleanup.field_cleanup_purge_line_purged
#: model:ir.model.fields,field_description:database_cleanup.field_cleanup_purge_line_table_purged #: model:ir.model.fields,field_description:database_cleanup.field_cleanup_purge_line_table_purged
msgid "Purged" msgid "Purged"
msgstr ""
msgstr "Purgat"
#. module: database_cleanup #. module: database_cleanup
#: model:ir.model.fields,field_description:database_cleanup.field_cleanup_purge_line_property_reason #: model:ir.model.fields,field_description:database_cleanup.field_cleanup_purge_line_property_reason
@ -479,61 +455,16 @@ msgstr ""
#. module: database_cleanup #. module: database_cleanup
#: model:ir.ui.view,arch_db:database_cleanup.form_purge_wizard #: model:ir.ui.view,arch_db:database_cleanup.form_purge_wizard
msgid "Select lines" msgid "Select lines"
msgstr ""
msgstr "Seleccionar línies"
#. module: database_cleanup #. module: database_cleanup
#: code:addons/database_cleanup/models/purge_wizard.py:73 #: code:addons/database_cleanup/models/purge_wizard.py:73
#, python-format #, python-format
msgid "Select lines to purge" msgid "Select lines to purge"
msgstr ""
msgstr "Seleccionar línies a purgar"
#. module: database_cleanup #. module: database_cleanup
#: model:ir.model.fields,field_description:database_cleanup.field_cleanup_purge_wizard_table_purge_line_ids #: model:ir.model.fields,field_description:database_cleanup.field_cleanup_purge_wizard_table_purge_line_ids
msgid "Tables to purge" msgid "Tables to purge"
msgstr ""
msgstr "Taules a purgar"
#. module: database_cleanup
#: model:ir.model.fields,field_description:database_cleanup.field_cleanup_create_indexes_line_wizard_id
#: model:ir.model.fields,field_description:database_cleanup.field_cleanup_purge_line_wizard_id
msgid "Wizard id"
msgstr ""
#. module: database_cleanup
#: model:ir.model,name:database_cleanup.model_cleanup_create_indexes_line
msgid "cleanup.create_indexes.line"
msgstr ""
#. module: database_cleanup
#: model:ir.model,name:database_cleanup.model_cleanup_purge_line
msgid "cleanup.purge.line"
msgstr ""
#. module: database_cleanup
#: model:ir.model,name:database_cleanup.model_cleanup_purge_line_column
msgid "cleanup.purge.line.column"
msgstr ""
#. module: database_cleanup
#: model:ir.model,name:database_cleanup.model_cleanup_purge_line_data
msgid "cleanup.purge.line.data"
msgstr ""
#. module: database_cleanup
#: model:ir.model,name:database_cleanup.model_cleanup_purge_line_menu
msgid "cleanup.purge.line.menu"
msgstr ""
#. module: database_cleanup
#: model:ir.model,name:database_cleanup.model_cleanup_purge_line_module
msgid "cleanup.purge.line.module"
msgstr ""
#. module: database_cleanup
#: model:ir.model,name:database_cleanup.model_cleanup_purge_line_table
msgid "cleanup.purge.line.table"
msgstr ""
#. module: database_cleanup
#: model:ir.model,name:database_cleanup.model_ir_model_data
msgid "ir.model.data"
msgstr ""

2
database_cleanup/i18n/database_cleanup.pot

@ -4,7 +4,7 @@
# #
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Odoo Server 8.0\n"
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-08-11 06:45+0000\n" "POT-Creation-Date: 2015-08-11 06:45+0000\n"
"PO-Revision-Date: 2015-08-11 06:45+0000\n" "PO-Revision-Date: 2015-08-11 06:45+0000\n"

2
database_cleanup/i18n/de.po

@ -7,7 +7,7 @@
# Rudolf Schnapka <rs@techno-flex.de>, 2017 # Rudolf Schnapka <rs@techno-flex.de>, 2017
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Odoo Server 9.0c\n"
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-04-19 18:00+0000\n" "POT-Creation-Date: 2017-04-19 18:00+0000\n"
"PO-Revision-Date: 2017-04-19 18:00+0000\n" "PO-Revision-Date: 2017-04-19 18:00+0000\n"

2
database_cleanup/i18n/el_GR.po

@ -6,7 +6,7 @@
# OCA Transbot <transbot@odoo-community.org>, 2016 # OCA Transbot <transbot@odoo-community.org>, 2016
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Odoo Server 9.0c\n"
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-04-19 18:00+0000\n" "POT-Creation-Date: 2017-04-19 18:00+0000\n"
"PO-Revision-Date: 2017-04-19 18:00+0000\n" "PO-Revision-Date: 2017-04-19 18:00+0000\n"

2
database_cleanup/i18n/es.po

@ -6,7 +6,7 @@
# OCA Transbot <transbot@odoo-community.org>, 2016 # OCA Transbot <transbot@odoo-community.org>, 2016
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Odoo Server 9.0c\n"
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-04-19 18:00+0000\n" "POT-Creation-Date: 2017-04-19 18:00+0000\n"
"PO-Revision-Date: 2017-04-19 18:00+0000\n" "PO-Revision-Date: 2017-04-19 18:00+0000\n"

2
database_cleanup/i18n/es_ES.po

@ -6,7 +6,7 @@
# OCA Transbot <transbot@odoo-community.org>, 2016 # OCA Transbot <transbot@odoo-community.org>, 2016
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Odoo Server 9.0c\n"
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-04-19 18:00+0000\n" "POT-Creation-Date: 2017-04-19 18:00+0000\n"
"PO-Revision-Date: 2017-04-19 18:00+0000\n" "PO-Revision-Date: 2017-04-19 18:00+0000\n"

2
database_cleanup/i18n/fi.po

@ -7,7 +7,7 @@
# Jarmo Kortetjärvi <jarmo.kortetjarvi@gmail.com>, 2017 # Jarmo Kortetjärvi <jarmo.kortetjarvi@gmail.com>, 2017
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Odoo Server 9.0c\n"
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-04-19 18:00+0000\n" "POT-Creation-Date: 2017-04-19 18:00+0000\n"
"PO-Revision-Date: 2017-04-19 18:00+0000\n" "PO-Revision-Date: 2017-04-19 18:00+0000\n"

2
database_cleanup/i18n/fr.po

@ -8,7 +8,7 @@
# dglucose <eric.lemesre@gmail.com>, 2017 # dglucose <eric.lemesre@gmail.com>, 2017
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Odoo Server 9.0c\n"
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-04-19 18:00+0000\n" "POT-Creation-Date: 2017-04-19 18:00+0000\n"
"PO-Revision-Date: 2017-04-19 18:00+0000\n" "PO-Revision-Date: 2017-04-19 18:00+0000\n"

2
database_cleanup/i18n/fr_CA.po

@ -6,7 +6,7 @@
# OCA Transbot <transbot@odoo-community.org>, 2016 # OCA Transbot <transbot@odoo-community.org>, 2016
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Odoo Server 9.0c\n"
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-04-19 18:00+0000\n" "POT-Creation-Date: 2017-04-19 18:00+0000\n"
"PO-Revision-Date: 2017-04-19 18:00+0000\n" "PO-Revision-Date: 2017-04-19 18:00+0000\n"

2
database_cleanup/i18n/gl.po

@ -7,7 +7,7 @@
# César Castro Cruz <ulmroan@gmail.com>, 2017 # César Castro Cruz <ulmroan@gmail.com>, 2017
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Odoo Server 9.0c\n"
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-04-19 18:00+0000\n" "POT-Creation-Date: 2017-04-19 18:00+0000\n"
"PO-Revision-Date: 2017-04-19 18:00+0000\n" "PO-Revision-Date: 2017-04-19 18:00+0000\n"

2
database_cleanup/i18n/hr.po

@ -7,7 +7,7 @@
# Ana-Maria Olujić <ana-maria.olujic@slobodni-programi.hr>, 2017 # Ana-Maria Olujić <ana-maria.olujic@slobodni-programi.hr>, 2017
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Odoo Server 9.0c\n"
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-04-19 18:00+0000\n" "POT-Creation-Date: 2017-04-19 18:00+0000\n"
"PO-Revision-Date: 2017-04-19 18:00+0000\n" "PO-Revision-Date: 2017-04-19 18:00+0000\n"

2
database_cleanup/i18n/hr_HR.po

@ -6,7 +6,7 @@
# OCA Transbot <transbot@odoo-community.org>, 2016 # OCA Transbot <transbot@odoo-community.org>, 2016
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Odoo Server 9.0c\n"
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-04-19 18:00+0000\n" "POT-Creation-Date: 2017-04-19 18:00+0000\n"
"PO-Revision-Date: 2017-04-19 18:00+0000\n" "PO-Revision-Date: 2017-04-19 18:00+0000\n"

2
database_cleanup/i18n/it.po

@ -7,7 +7,7 @@
# Paolo Valier <paolo.valier@hotmail.it>, 2017 # Paolo Valier <paolo.valier@hotmail.it>, 2017
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Odoo Server 9.0c\n"
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-04-19 18:00+0000\n" "POT-Creation-Date: 2017-04-19 18:00+0000\n"
"PO-Revision-Date: 2017-04-19 18:00+0000\n" "PO-Revision-Date: 2017-04-19 18:00+0000\n"

2
database_cleanup/i18n/nl.po

@ -8,7 +8,7 @@
# Erwin van der Ploeg <erwin@odooexperts.nl>, 2017 # Erwin van der Ploeg <erwin@odooexperts.nl>, 2017
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Odoo Server 9.0c\n"
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-04-19 18:00+0000\n" "POT-Creation-Date: 2017-04-19 18:00+0000\n"
"PO-Revision-Date: 2017-04-19 18:00+0000\n" "PO-Revision-Date: 2017-04-19 18:00+0000\n"

2
database_cleanup/i18n/pt.po

@ -6,7 +6,7 @@
# OCA Transbot <transbot@odoo-community.org>, 2016 # OCA Transbot <transbot@odoo-community.org>, 2016
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Odoo Server 9.0c\n"
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-04-19 18:00+0000\n" "POT-Creation-Date: 2017-04-19 18:00+0000\n"
"PO-Revision-Date: 2017-04-19 18:00+0000\n" "PO-Revision-Date: 2017-04-19 18:00+0000\n"

2
database_cleanup/i18n/pt_BR.po

@ -7,7 +7,7 @@
# danimaribeiro <danimaribeiro@gmail.com>, 2017 # danimaribeiro <danimaribeiro@gmail.com>, 2017
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Odoo Server 9.0c\n"
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-04-19 18:00+0000\n" "POT-Creation-Date: 2017-04-19 18:00+0000\n"
"PO-Revision-Date: 2017-04-19 18:00+0000\n" "PO-Revision-Date: 2017-04-19 18:00+0000\n"

2
database_cleanup/i18n/pt_PT.po

@ -7,7 +7,7 @@
# Pedro Castro Silva <pedrocs@sossia.pt>, 2017 # Pedro Castro Silva <pedrocs@sossia.pt>, 2017
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Odoo Server 9.0c\n"
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-04-19 18:00+0000\n" "POT-Creation-Date: 2017-04-19 18:00+0000\n"
"PO-Revision-Date: 2017-04-19 18:00+0000\n" "PO-Revision-Date: 2017-04-19 18:00+0000\n"

2
database_cleanup/i18n/ru.po

@ -6,7 +6,7 @@
# OCA Transbot <transbot@odoo-community.org>, 2016 # OCA Transbot <transbot@odoo-community.org>, 2016
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Odoo Server 9.0c\n"
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-04-19 18:00+0000\n" "POT-Creation-Date: 2017-04-19 18:00+0000\n"
"PO-Revision-Date: 2017-04-19 18:00+0000\n" "PO-Revision-Date: 2017-04-19 18:00+0000\n"

2
database_cleanup/i18n/sl.po

@ -7,7 +7,7 @@
# Matjaž Mozetič <m.mozetic@matmoz.si>, 2017 # Matjaž Mozetič <m.mozetic@matmoz.si>, 2017
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Odoo Server 9.0c\n"
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-04-19 18:00+0000\n" "POT-Creation-Date: 2017-04-19 18:00+0000\n"
"PO-Revision-Date: 2017-04-19 18:00+0000\n" "PO-Revision-Date: 2017-04-19 18:00+0000\n"

2
database_cleanup/i18n/tr.po

@ -7,7 +7,7 @@
# Ahmet Altinisik <aaltinisik@altinkaya.com.tr>, 2017 # Ahmet Altinisik <aaltinisik@altinkaya.com.tr>, 2017
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Odoo Server 9.0c\n"
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-04-19 18:00+0000\n" "POT-Creation-Date: 2017-04-19 18:00+0000\n"
"PO-Revision-Date: 2017-04-19 18:00+0000\n" "PO-Revision-Date: 2017-04-19 18:00+0000\n"

2
database_cleanup/i18n/zh_CN.po

@ -6,7 +6,7 @@
# OCA Transbot <transbot@odoo-community.org>, 2016 # OCA Transbot <transbot@odoo-community.org>, 2016
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Odoo Server 9.0c\n"
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-04-19 18:00+0000\n" "POT-Creation-Date: 2017-04-19 18:00+0000\n"
"PO-Revision-Date: 2017-04-19 18:00+0000\n" "PO-Revision-Date: 2017-04-19 18:00+0000\n"

8
database_cleanup/models/create_indexes.py

@ -2,7 +2,7 @@
# © 2017 Therp BV <http://therp.nl> # © 2017 Therp BV <http://therp.nl>
# 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 ..identifier_adapter import IdentifierAdapter from ..identifier_adapter import IdentifierAdapter
from openerp import api, fields, models
from odoo import api, fields, models
class CreateIndexesLine(models.TransientModel): class CreateIndexesLine(models.TransientModel):
@ -48,6 +48,7 @@ class CreateIndexesWizard(models.TransientModel):
@api.multi @api.multi
def find(self): def find(self):
res = list()
for field in self.env['ir.model.fields'].search([ for field in self.env['ir.model.fields'].search([
('index', '=', True), ('index', '=', True),
]): ]):
@ -74,7 +75,8 @@ class CreateIndexesWizard(models.TransientModel):
if not self.env.cr.rowcount: if not self.env.cr.rowcount:
continue continue
yield (0, 0, {
res.append((0, 0, {
'name': '%s.%s' % (field.model, field.name), 'name': '%s.%s' % (field.model, field.name),
'field_id': field.id, 'field_id': field.id,
})
}))
return res

19
database_cleanup/models/purge_columns.py

@ -1,8 +1,8 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# © 2014-2016 Therp BV <http://therp.nl> # © 2014-2016 Therp BV <http://therp.nl>
# 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 openerp import _, api, fields, models
from openerp.exceptions import UserError
from odoo import _, api, fields, models
from odoo.exceptions import UserError
from ..identifier_adapter import IdentifierAdapter from ..identifier_adapter import IdentifierAdapter
@ -20,7 +20,12 @@ class CleanupPurgeLineColumn(models.TransientModel):
""" """
Unlink columns upon manual confirmation. Unlink columns upon manual confirmation.
""" """
for line in self:
if self:
objs = self
else:
objs = self.env['cleanup.purge.line.column']\
.browse(self._context.get('active_ids'))
for line in objs:
if line.purged: if line.purged:
continue continue
model_pool = self.env[line.model_id.model] model_pool = self.env[line.model_id.model]
@ -71,12 +76,10 @@ class CleanupPurgeWizardColumn(models.TransientModel):
of fields which have been removed of fields which have been removed
""" """
columns = list(set([ columns = list(set([
column
column.name
for model_pool in model_pools for model_pool in model_pools
for column in model_pool._columns
if not (isinstance(model_pool._columns[column],
fields.fields.function) and
not model_pool._columns[column].store)
for column in model_pool._fields.values()
if not (column.compute is not None and not column.store)
])) ]))
columns += models.MAGIC_COLUMNS columns += models.MAGIC_COLUMNS
columns += self.blacklist.get(model_pools[0]._table, []) columns += self.blacklist.get(model_pools[0]._table, [])

13
database_cleanup/models/purge_data.py

@ -1,8 +1,8 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# © 2014-2016 Therp BV <http://therp.nl> # © 2014-2016 Therp BV <http://therp.nl>
# 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 openerp import _, api, fields, models
from openerp.exceptions import UserError
from odoo import _, api, fields, models
from odoo.exceptions import UserError
from ..identifier_adapter import IdentifierAdapter from ..identifier_adapter import IdentifierAdapter
@ -17,10 +17,15 @@ class CleanupPurgeLineData(models.TransientModel):
@api.multi @api.multi
def purge(self): def purge(self):
"""Unlink data entries upon manual confirmation.""" """Unlink data entries upon manual confirmation."""
to_unlink = self.filtered(lambda x: not x.purged and x.data_id)
if self:
objs = self
else:
objs = self.env['cleanup.purge.line.data']\
.browse(self._context.get('active_ids'))
to_unlink = objs.filtered(lambda x: not x.purged and x.data_id)
self.logger.info('Purging data entries: %s', to_unlink.mapped('name')) self.logger.info('Purging data entries: %s', to_unlink.mapped('name'))
to_unlink.mapped('data_id').unlink() to_unlink.mapped('data_id').unlink()
return self.write({'purged': True})
return to_unlink.write({'purged': True})
class CleanupPurgeWizardData(models.TransientModel): class CleanupPurgeWizardData(models.TransientModel):

16
database_cleanup/models/purge_menus.py

@ -1,8 +1,8 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# © 2014-2016 Therp BV <http://therp.nl> # © 2014-2016 Therp BV <http://therp.nl>
# 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 openerp import _, api, fields, models
from openerp.exceptions import UserError
from odoo import _, api, fields, models
from odoo.exceptions import UserError
class CleanupPurgeLineMenu(models.TransientModel): class CleanupPurgeLineMenu(models.TransientModel):
@ -15,8 +15,16 @@ class CleanupPurgeLineMenu(models.TransientModel):
@api.multi @api.multi
def purge(self): def purge(self):
self.mapped('menu_id').unlink()
return self.write({'purged': True})
"""Unlink menu entries upon manual confirmation."""
if self:
objs = self
else:
objs = self.env['cleanup.purge.line.menu']\
.browse(self._context.get('active_ids'))
to_unlink = objs.filtered(lambda x: not x.purged and x.menu_id)
self.logger.info('Purging menu entries: %s', to_unlink.mapped('name'))
to_unlink.mapped('menu_id').unlink()
return to_unlink.write({'purged': True})
class CleanupPurgeWizardMenu(models.TransientModel): class CleanupPurgeWizardMenu(models.TransientModel):

49
database_cleanup/models/purge_models.py

@ -1,15 +1,14 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# © 2014-2016 Therp BV <http://therp.nl> # © 2014-2016 Therp BV <http://therp.nl>
# 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 openerp import _, api, models, fields
from openerp.exceptions import UserError
from openerp.addons.base.ir.ir_model import MODULE_UNINSTALL_FLAG
from odoo import _, api, models, fields
from odoo.exceptions import UserError
from odoo.addons.base.ir.ir_model import MODULE_UNINSTALL_FLAG
class IrModel(models.Model): class IrModel(models.Model):
_inherit = 'ir.model' _inherit = 'ir.model'
@api.multi
def _drop_table(self): def _drop_table(self):
# Allow to skip this step during model unlink # Allow to skip this step during model unlink
# The super method crashes if the model cannot be instantiated # The super method crashes if the model cannot be instantiated
@ -17,25 +16,23 @@ class IrModel(models.Model):
return True return True
return super(IrModel, self)._drop_table() return super(IrModel, self)._drop_table()
@api.multi
def _inherited_models(self, field_name, arg):
@api.depends()
def _inherited_models(self):
"""this function crashes for undefined models""" """this function crashes for undefined models"""
result = dict((i, []) for i in self.ids)
existing_model_ids = [
this.id for this in self if this.model in self.env
]
super_result = super(IrModel, self.browse(existing_model_ids))\
._inherited_models(field_name, arg)
result.update(super_result)
return result
def _register_hook(self, cr):
# patch the function field instead of overwriting it
if self._columns['inherited_model_ids']._fnct !=\
self._inherited_models.__func__:
self._columns['inherited_model_ids']._fnct =\
self._inherited_models.__func__
return super(IrModel, self)._register_hook(cr)
existing_model_ids = self.filtered(lambda x: x.model in self.env)
super(IrModel, existing_model_ids)._inherited_models()
class IrModelFields(models.Model):
_inherit = 'ir.model.fields'
@api.multi
def _prepare_update(self):
# Allow to skip this step during model unlink
# The super method crashes if the model cannot be instantiated
if self.env.context.get('no_prepare_update'):
return True
return super(IrModelFields, self)._prepare_update()
class CleanupPurgeLineModel(models.TransientModel): class CleanupPurgeLineModel(models.TransientModel):
@ -55,9 +52,15 @@ class CleanupPurgeLineModel(models.TransientModel):
MODULE_UNINSTALL_FLAG: True, MODULE_UNINSTALL_FLAG: True,
'no_drop_table': True, 'no_drop_table': True,
'purge': True, 'purge': True,
'no_prepare_update': True,
} }
for line in self:
if self:
objs = self
else:
objs = self.env['cleanup.purge.line.model']\
.browse(self._context.get('active_ids'))
for line in objs:
self.env.cr.execute( self.env.cr.execute(
"SELECT id, model from ir_model WHERE model = %s", "SELECT id, model from ir_model WHERE model = %s",
(line.name,)) (line.name,))

19
database_cleanup/models/purge_modules.py

@ -1,11 +1,11 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# © 2014-2016 Therp BV <http://therp.nl> # © 2014-2016 Therp BV <http://therp.nl>
# 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 openerp import _, api, fields, models
from openerp.exceptions import UserError
from openerp.modules.registry import RegistryManager
from openerp.modules.module import get_module_path
from openerp.addons.base.ir.ir_model import MODULE_UNINSTALL_FLAG
from odoo import _, api, fields, models
from odoo.exceptions import UserError
from odoo.modules.registry import RegistryManager
from odoo.modules.module import get_module_path
from odoo.addons.base.ir.ir_model import MODULE_UNINSTALL_FLAG
class IrModelData(models.Model): class IrModelData(models.Model):
@ -41,7 +41,12 @@ class CleanupPurgeLineModule(models.TransientModel):
Uninstall modules upon manual confirmation, then reload Uninstall modules upon manual confirmation, then reload
the database. the database.
""" """
module_names = self.filtered(lambda x: not x.purged).mapped('name')
if self:
objs = self
else:
objs = self.env['cleanup.purge.line.module']\
.browse(self._context.get('active_ids'))
module_names = objs.filtered(lambda x: not x.purged).mapped('name')
modules = self.env['ir.module.module'].search([ modules = self.env['ir.module.module'].search([
('name', 'in', module_names) ('name', 'in', module_names)
]) ])
@ -54,7 +59,7 @@ class CleanupPurgeLineModule(models.TransientModel):
self.env.cr.commit() # pylint: disable=invalid-commit self.env.cr.commit() # pylint: disable=invalid-commit
RegistryManager.new(self.env.cr.dbname, update_module=True) RegistryManager.new(self.env.cr.dbname, update_module=True)
modules.unlink() modules.unlink()
return self.write({'purged': True})
return objs.write({'purged': True})
class CleanupPurgeWizardModule(models.TransientModel): class CleanupPurgeWizardModule(models.TransientModel):

6
database_cleanup/models/purge_properties.py

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# © 2017 Therp BV <http://therp.nl> # © 2017 Therp BV <http://therp.nl>
# 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 openerp import api, models, fields
from odoo import api, models, fields
REASON_DUPLICATE = 1 REASON_DUPLICATE = 1
REASON_DEFAULT = 2 REASON_DEFAULT = 2
@ -76,7 +76,7 @@ class CleanupPurgeWizardProperty(models.TransientModel):
for redundant_property in self.env['ir.property'].search(domain): for redundant_property in self.env['ir.property'].search(domain):
result.append({ result.append({
'name': '%s@%s: %s' % ( 'name': '%s@%s: %s' % (
prop.name, prop.res_id, prop.get_by_record(prop)
prop.name, prop.res_id, prop.get_by_record()
), ),
'property_id': redundant_property.id, 'property_id': redundant_property.id,
'reason': REASON_DEFAULT, 'reason': REASON_DEFAULT,
@ -98,7 +98,7 @@ class CleanupPurgeWizardProperty(models.TransientModel):
])[1:]: ])[1:]:
result.append({ result.append({
'name': '%s@%s: %s' % ( 'name': '%s@%s: %s' % (
prop.name, prop.res_id, prop.get_by_record(prop)
prop.name, prop.res_id, prop.get_by_record()
), ),
'property_id': prop.id, 'property_id': prop.id,
'reason': REASON_DUPLICATE, 'reason': REASON_DUPLICATE,

22
database_cleanup/models/purge_tables.py

@ -1,8 +1,8 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# © 2014-2016 Therp BV <http://therp.nl> # © 2014-2016 Therp BV <http://therp.nl>
# 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 openerp import api, fields, models, _
from openerp.exceptions import UserError
from odoo import api, fields, models, _
from odoo.exceptions import UserError
from ..identifier_adapter import IdentifierAdapter from ..identifier_adapter import IdentifierAdapter
@ -18,8 +18,13 @@ class CleanupPurgeLineTable(models.TransientModel):
""" """
Unlink tables upon manual confirmation. Unlink tables upon manual confirmation.
""" """
tables = self.mapped('name')
for line in self:
if self:
objs = self
else:
objs = self.env['cleanup.purge.line.table']\
.browse(self._context.get('active_ids'))
tables = objs.mapped('name')
for line in objs:
if line.purged: if line.purged:
continue continue
@ -84,11 +89,10 @@ class CleanupPurgeWizardTable(models.TransientModel):
model_pool = self.env[model.model] model_pool = self.env[model.model]
known_tables.append(model_pool._table) known_tables.append(model_pool._table)
known_tables += [ known_tables += [
column._sql_names(model_pool)[0]
for column in model_pool._columns.values()
if (column._type == 'many2many' and
hasattr(column, '_rel')) # unstored function fields of
# type m2m don't have _rel
column.relation
for column in model_pool._fields.values()
if column.type == 'many2many' and
(column.compute is None or column.store)
] ]
self.env.cr.execute( self.env.cr.execute(

6
database_cleanup/models/purge_wizard.py

@ -2,8 +2,8 @@
# © 2014-2016 Therp BV <http://therp.nl> # © 2014-2016 Therp BV <http://therp.nl>
# 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).
import logging import logging
from openerp import _, api, fields, models
from openerp.exceptions import AccessDenied
from odoo import _, api, fields, models
from odoo.exceptions import AccessDenied
class CleanupPurgeLine(models.AbstractModel): class CleanupPurgeLine(models.AbstractModel):
@ -15,7 +15,7 @@ class CleanupPurgeLine(models.AbstractModel):
purged = fields.Boolean('Purged', readonly=True) purged = fields.Boolean('Purged', readonly=True)
wizard_id = fields.Many2one('cleanup.purge.wizard') wizard_id = fields.Many2one('cleanup.purge.wizard')
logger = logging.getLogger('openerp.addons.database_cleanup')
logger = logging.getLogger('odoo.addons.database_cleanup')
@api.multi @api.multi
def purge(self): def purge(self):

32
database_cleanup/tests/test_database_cleanup.py

@ -2,9 +2,9 @@
# © 2016 Therp BV <http://therp.nl> # © 2016 Therp BV <http://therp.nl>
# 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 psycopg2 import ProgrammingError from psycopg2 import ProgrammingError
from openerp.modules.registry import RegistryManager
from openerp.tools import config
from openerp.tests.common import TransactionCase, at_install, post_install
from odoo.modules.registry import Registry
from odoo.tools import config
from odoo.tests.common import TransactionCase, at_install, post_install
# Use post_install to get all models loaded more info: odoo/odoo#13458 # Use post_install to get all models loaded more info: odoo/odoo#13458
@ -15,6 +15,12 @@ class TestDatabaseCleanup(TransactionCase):
super(TestDatabaseCleanup, self).setUp() super(TestDatabaseCleanup, self).setUp()
self.module = None self.module = None
self.model = None self.model = None
# Create one property for tests
self.env['ir.property'].create({
'fields_id': self.env.ref('base.field_res_partner_name').id,
'type': 'char',
'value_text': 'My default partner name',
})
def test_database_cleanup(self): def test_database_cleanup(self):
# delete some index and check if our module recreated it # delete some index and check if our module recreated it
@ -33,7 +39,7 @@ class TestDatabaseCleanup(TransactionCase):
purge_property.purge_all() purge_property.purge_all()
self.assertFalse(duplicate_property.exists()) self.assertFalse(duplicate_property.exists())
# create an orphaned column # create an orphaned column
self.cr.execute(
self.env.cr.execute(
'alter table res_partner add column database_cleanup_test int') 'alter table res_partner add column database_cleanup_test int')
# We need use a model that is not blocked (Avoid use res.users) # We need use a model that is not blocked (Avoid use res.users)
partner_model = self.env['ir.model'].search([ partner_model = self.env['ir.model'].search([
@ -45,16 +51,16 @@ class TestDatabaseCleanup(TransactionCase):
purge_columns.purge_all() purge_columns.purge_all()
# must be removed by the wizard # must be removed by the wizard
with self.assertRaises(ProgrammingError): with self.assertRaises(ProgrammingError):
with self.registry.cursor() as cr:
with self.env.registry.cursor() as cr:
cr.execute('select database_cleanup_test from res_partner') cr.execute('select database_cleanup_test from res_partner')
# create a data entry pointing nowhere # create a data entry pointing nowhere
self.cr.execute('select max(id) + 1 from res_users')
self.env.cr.execute('select max(id) + 1 from res_users')
self.env['ir.model.data'].create({ self.env['ir.model.data'].create({
'module': 'database_cleanup', 'module': 'database_cleanup',
'name': 'test_no_data_entry', 'name': 'test_no_data_entry',
'model': 'res.users', 'model': 'res.users',
'res_id': self.cr.fetchone()[0],
'res_id': self.env.cr.fetchone()[0],
}) })
purge_data = self.env['cleanup.purge.wizard.data'].create({}) purge_data = self.env['cleanup.purge.wizard.data'].create({})
purge_data.purge_all() purge_data.purge_all()
@ -70,8 +76,8 @@ class TestDatabaseCleanup(TransactionCase):
self.env.cr.execute( self.env.cr.execute(
'insert into ir_attachment (name, res_model, res_id, type) values ' 'insert into ir_attachment (name, res_model, res_id, type) values '
"('test attachment', 'database.cleanup.test.model', 42, 'binary')") "('test attachment', 'database.cleanup.test.model', 42, 'binary')")
self.registry.models.pop('x_database.cleanup.test.model')
self.registry._pure_function_fields.pop(
self.env.registry.models.pop('x_database.cleanup.test.model')
self.env.registry._fields_by_model.pop(
'x_database.cleanup.test.model') 'x_database.cleanup.test.model')
purge_models = self.env['cleanup.purge.wizard.model'].create({}) purge_models = self.env['cleanup.purge.wizard.model'].create({})
purge_models.purge_all() purge_models.purge_all()
@ -89,7 +95,7 @@ class TestDatabaseCleanup(TransactionCase):
# this reloads our registry, and we don't want to run tests twice # this reloads our registry, and we don't want to run tests twice
# we also need the original registry for further tests, so save a # we also need the original registry for further tests, so save a
# reference to it # reference to it
original_registry = RegistryManager.registries[self.env.cr.dbname]
original_registry = Registry.registries[self.env.cr.dbname]
config.options['test_enable'] = False config.options['test_enable'] = False
purge_modules.purge_all() purge_modules.purge_all()
config.options['test_enable'] = True config.options['test_enable'] = True
@ -98,15 +104,15 @@ class TestDatabaseCleanup(TransactionCase):
('name', '=', 'database_cleanup_test'), ('name', '=', 'database_cleanup_test'),
])) ]))
# reset afterwards # reset afterwards
RegistryManager.registries[self.env.cr.dbname] = original_registry
Registry.registries[self.env.cr.dbname] = original_registry
# create an orphaned table # create an orphaned table
self.env.cr.execute('create table database_cleanup_test (test int)') self.env.cr.execute('create table database_cleanup_test (test int)')
purge_tables = self.env['cleanup.purge.wizard.table'].create({}) purge_tables = self.env['cleanup.purge.wizard.table'].create({})
purge_tables.purge_all() purge_tables.purge_all()
with self.assertRaises(ProgrammingError): with self.assertRaises(ProgrammingError):
with self.registry.cursor() as cr:
self.env.cr.execute('select * from database_cleanup_test')
with self.env.registry.cursor() as cr:
cr.execute('select * from database_cleanup_test')
def tearDown(self): def tearDown(self):
super(TestDatabaseCleanup, self).tearDown() super(TestDatabaseCleanup, self).tearDown()

4
database_cleanup/views/create_indexes.xml

@ -19,7 +19,7 @@
<field name="type">ir.actions.server</field> <field name="type">ir.actions.server</field>
<field name="state">code</field> <field name="state">code</field>
<field name="model_id" ref="database_cleanup.model_cleanup_create_indexes_wizard" /> <field name="model_id" ref="database_cleanup.model_cleanup_create_indexes_wizard" />
<field name="code">action = self.get_wizard_action(cr, uid, context=context)</field>
<field name="code">action = env.get('cleanup.create_indexes.wizard').get_wizard_action()</field>
</record> </record>
<record id="cleanup_create_indexes_line_view_tree" model="ir.ui.view"> <record id="cleanup_create_indexes_line_view_tree" model="ir.ui.view">
@ -39,7 +39,7 @@
<field name="type">ir.actions.server</field> <field name="type">ir.actions.server</field>
<field name="state">code</field> <field name="state">code</field>
<field name="model_id" ref="database_cleanup.model_cleanup_create_indexes_line" /> <field name="model_id" ref="database_cleanup.model_cleanup_create_indexes_line" />
<field name="code">self.purge(cr, uid, context.get('active_ids', []), context)</field>
<field name="code">env.get('cleanup.create_indexes.line').purge()</field>
</record> </record>
<record id="cleanup_create_indexes_line_action_value" model="ir.values"> <record id="cleanup_create_indexes_line_action_value" model="ir.values">

118
database_cleanup/views/menu.xml

@ -1,70 +1,66 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<odoo>
<record model="ir.ui.menu" id="menu_database_cleanup">
<field name="name">Database cleanup</field>
<field name="sequence" eval="10" />
<!-- attach to Settings -> Technical -->
<field name="parent_id" ref="base.menu_custom"/>
<field name="groups_id" eval="[(6,0, [ref('base.group_erp_manager')])]"/>
</record>
<record model="ir.ui.menu" id="menu_database_cleanup">
<field name="name">Database cleanup</field>
<field name="sequence" eval="10" />
<!-- attach to Settings -> Technical -->
<field name="parent_id" ref="base.menu_custom"/>
<field name="groups_id" eval="[(6,0, [ref('base.group_erp_manager')])]"/>
</record>
<record model="ir.ui.menu" id="menu_purge_modules">
<field name="name">Purge obsolete modules</field>
<field name="sequence" eval="10" />
<field name="action" ref="action_purge_modules" />
<field name="parent_id" ref="menu_database_cleanup"/>
</record>
<record model="ir.ui.menu" id="menu_purge_modules">
<field name="name">Purge obsolete modules</field>
<field name="sequence" eval="10" />
<field name="action" ref="action_purge_modules" />
<field name="parent_id" ref="menu_database_cleanup"/>
</record>
<record model="ir.ui.menu" id="menu_purge_models">
<field name="name">Purge obsolete models</field>
<field name="sequence" eval="20" />
<field name="action" ref="action_purge_models" />
<field name="parent_id" ref="menu_database_cleanup"/>
</record>
<record model="ir.ui.menu" id="menu_purge_models">
<field name="name">Purge obsolete models</field>
<field name="sequence" eval="20" />
<field name="action" ref="action_purge_models" />
<field name="parent_id" ref="menu_database_cleanup"/>
</record>
<record model="ir.ui.menu" id="menu_purge_columns">
<field name="name">Purge obsolete columns</field>
<field name="sequence" eval="30" />
<field name="action" ref="action_purge_columns" />
<field name="parent_id" ref="menu_database_cleanup"/>
</record>
<record model="ir.ui.menu" id="menu_purge_columns">
<field name="name">Purge obsolete columns</field>
<field name="sequence" eval="30" />
<field name="action" ref="action_purge_columns" />
<field name="parent_id" ref="menu_database_cleanup"/>
</record>
<record model="ir.ui.menu" id="menu_purge_tables">
<field name="name">Purge obsolete tables</field>
<field name="sequence" eval="40" />
<field name="action" ref="action_purge_tables" />
<field name="parent_id" ref="menu_database_cleanup"/>
</record>
<record model="ir.ui.menu" id="menu_purge_tables">
<field name="name">Purge obsolete tables</field>
<field name="sequence" eval="40" />
<field name="action" ref="action_purge_tables" />
<field name="parent_id" ref="menu_database_cleanup"/>
</record>
<record model="ir.ui.menu" id="menu_purge_data">
<field name="name">Purge obsolete data entries</field>
<field name="sequence" eval="50" />
<field name="action" ref="action_purge_data" />
<field name="parent_id" ref="menu_database_cleanup"/>
</record>
<record model="ir.ui.menu" id="menu_purge_data">
<field name="name">Purge obsolete data entries</field>
<field name="sequence" eval="50" />
<field name="action" ref="action_purge_data" />
<field name="parent_id" ref="menu_database_cleanup"/>
</record>
<record model="ir.ui.menu" id="menu_purge_menus">
<field name="name">Purge obsolete menu entries</field>
<field name="sequence" eval="60" />
<field name="action" ref="action_purge_menus" />
<field name="parent_id" ref="menu_database_cleanup"/>
</record>
<record model="ir.ui.menu" id="menu_purge_menus">
<field name="name">Purge obsolete menu entries</field>
<field name="sequence" eval="60" />
<field name="action" ref="action_purge_menus" />
<field name="parent_id" ref="menu_database_cleanup"/>
</record>
<record model="ir.ui.menu" id="menu_create_indexes">
<field name="name">Create missing indexes</field>
<field name="sequence" eval="70" />
<field name="action" ref="cleanup_create_indexes_wizard_action" />
<field name="parent_id" ref="menu_database_cleanup"/>
</record>
<record model="ir.ui.menu" id="menu_create_indexes">
<field name="name">Create missing indexes</field>
<field name="sequence" eval="70" />
<field name="action" ref="cleanup_create_indexes_wizard_action" />
<field name="parent_id" ref="menu_database_cleanup"/>
</record>
<record model="ir.ui.menu" id="menu_purge_property">
<field name="name">Purge obsolete properties</field>
<field name="sequence" eval="80" />
<field name="action" ref="action_purge_property" />
<field name="parent_id" ref="menu_database_cleanup"/>
</record>
</data>
</openerp>
<record model="ir.ui.menu" id="menu_purge_property">
<field name="name">Purge obsolete properties</field>
<field name="sequence" eval="80" />
<field name="action" ref="action_purge_property" />
<field name="parent_id" ref="menu_database_cleanup"/>
</record>
</odoo>

88
database_cleanup/views/purge_columns.xml

@ -1,50 +1,52 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="purge_columns_view" model="ir.ui.view">
<field name="model">cleanup.purge.wizard.column</field>
<field name="inherit_id" ref="form_purge_wizard" />
<field name="mode">primary</field>
<field name="arch" type="xml">
<field name="name" position="after">
<field name="model_id" />
</field>
<odoo>
<record id="purge_columns_view" model="ir.ui.view">
<field name="model">cleanup.purge.wizard.column</field>
<field name="inherit_id" ref="form_purge_wizard" />
<field name="mode">primary</field>
<field name="arch" type="xml">
<field name="name" position="after">
<field name="model_id" />
</field> </field>
</record>
</field>
</record>
<record id="action_purge_columns" model="ir.actions.server">
<field name="name">Purge columns</field>
<field name="type">ir.actions.server</field>
<field name="state">code</field>
<field name="model_id" ref="database_cleanup.model_cleanup_purge_wizard_column" />
<field name="code">action = self.get_wizard_action(cr, uid, context=context)</field>
</record>
<record id="action_purge_columns" model="ir.actions.server">
<field name="name">Purge columns</field>
<field name="type">ir.actions.server</field>
<field name="state">code</field>
<field name="model_id" ref="database_cleanup.model_cleanup_purge_wizard_column" />
<field name="code">
action = env.get('cleanup.purge.wizard.column').get_wizard_action()
</field>
</record>
<record id="purge_column_line_tree" model="ir.ui.view">
<field name="model">cleanup.purge.line.column</field>
<field name="inherit_id" ref="tree_purge_line" />
<field name="mode">primary</field>
<field name="arch" type="xml">
<field name="name" position="after">
<field name="model_id" />
</field>
<record id="purge_column_line_tree" model="ir.ui.view">
<field name="model">cleanup.purge.line.column</field>
<field name="inherit_id" ref="tree_purge_line" />
<field name="mode">primary</field>
<field name="arch" type="xml">
<field name="name" position="after">
<field name="model_id" />
</field> </field>
</record>
</field>
</record>
<record id="action_purge_column_line" model="ir.actions.server">
<field name="name">Purge</field>
<field name="type">ir.actions.server</field>
<field name="state">code</field>
<field name="model_id" ref="database_cleanup.model_cleanup_purge_line_column" />
<field name="code">self.purge(cr, uid, context.get('active_ids', []), context)</field>
</record>
<record id="action_purge_column_line" model="ir.actions.server">
<field name="name">Purge</field>
<field name="type">ir.actions.server</field>
<field name="state">code</field>
<field name="model_id" ref="database_cleanup.model_cleanup_purge_line_column" />
<field name="code">
env.get('cleanup.purge.line.column').purge()
</field>
</record>
<record id="action_purge_column_line_value" model="ir.values">
<field name="name">Purge</field>
<field name="key">action</field>
<field name="key2">client_action_multi</field>
<field name="model">cleanup.purge.line.column</field>
<field name="value" eval="'ir.actions.server,%d' % ref('database_cleanup.action_purge_column_line')" />
</record>
</data>
</openerp>
<record id="action_purge_column_line_value" model="ir.values">
<field name="name">Purge</field>
<field name="key">action</field>
<field name="key2">client_action_multi</field>
<field name="model">cleanup.purge.line.column</field>
<field name="value" eval="'ir.actions.server,%d' % ref('database_cleanup.action_purge_column_line')" />
</record>
</odoo>

88
database_cleanup/views/purge_data.xml

@ -1,50 +1,52 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="purge_data_view" model="ir.ui.view">
<field name="model">cleanup.purge.wizard.data</field>
<field name="inherit_id" ref="form_purge_wizard" />
<field name="mode">primary</field>
<field name="arch" type="xml">
<field name="name" position="after">
<field name="data_id" />
</field>
<odoo>
<record id="purge_data_view" model="ir.ui.view">
<field name="model">cleanup.purge.wizard.data</field>
<field name="inherit_id" ref="form_purge_wizard" />
<field name="mode">primary</field>
<field name="arch" type="xml">
<field name="name" position="after">
<field name="data_id" />
</field> </field>
</record>
</field>
</record>
<record id="action_purge_data" model="ir.actions.server">
<field name="name">Purge data entries that refer to missing resources</field>
<field name="type">ir.actions.server</field>
<field name="state">code</field>
<field name="model_id" ref="database_cleanup.model_cleanup_purge_wizard_data" />
<field name="code">action = self.get_wizard_action(cr, uid, context=context)</field>
</record>
<record id="action_purge_data" model="ir.actions.server">
<field name="name">Purge data entries that refer to missing resources</field>
<field name="type">ir.actions.server</field>
<field name="state">code</field>
<field name="model_id" ref="database_cleanup.model_cleanup_purge_wizard_data" />
<field name="code">
action = env.get('cleanup.purge.wizard.data').get_wizard_action()
</field>
</record>
<record id="purge_data_line_tree" model="ir.ui.view">
<field name="model">cleanup.purge.line.data</field>
<field name="inherit_id" ref="tree_purge_line" />
<field name="mode">primary</field>
<field name="arch" type="xml">
<field name="name" position="after">
<field name="data_id" />
</field>
<record id="purge_data_line_tree" model="ir.ui.view">
<field name="model">cleanup.purge.line.data</field>
<field name="inherit_id" ref="tree_purge_line" />
<field name="mode">primary</field>
<field name="arch" type="xml">
<field name="name" position="after">
<field name="data_id" />
</field> </field>
</record>
</field>
</record>
<record id="action_purge_data_line" model="ir.actions.server">
<field name="name">Purge</field>
<field name="type">ir.actions.server</field>
<field name="state">code</field>
<field name="model_id" ref="database_cleanup.model_cleanup_purge_line_data" />
<field name="code">self.purge(cr, uid, context.get('active_ids', []), context)</field>
</record>
<record id="action_purge_data_line" model="ir.actions.server">
<field name="name">Purge</field>
<field name="type">ir.actions.server</field>
<field name="state">code</field>
<field name="model_id" ref="database_cleanup.model_cleanup_purge_line_data" />
<field name="code">
env.get('cleanup.purge.line.data').purge()
</field>
</record>
<record id="action_purge_data_line_value" model="ir.values">
<field name="name">Purge</field>
<field name="key">action</field>
<field name="key2">client_action_multi</field>
<field name="model">cleanup.purge.line.data</field>
<field name="value" eval="'ir.actions.server,%d' % ref('database_cleanup.action_purge_data_line')" />
</record>
</data>
</openerp>
<record id="action_purge_data_line_value" model="ir.values">
<field name="name">Purge</field>
<field name="key">action</field>
<field name="key2">client_action_multi</field>
<field name="model">cleanup.purge.line.data</field>
<field name="value" eval="'ir.actions.server,%d' % ref('database_cleanup.action_purge_data_line')" />
</record>
</odoo>

85
database_cleanup/views/purge_menus.xml

@ -1,47 +1,48 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="purge_menus_view" model="ir.ui.view">
<field name="model">cleanup.purge.wizard.menu</field>
<field name="inherit_id" ref="form_purge_wizard" />
<field name="mode">primary</field>
<field name="arch" type="xml">
<data/>
</field>
</record>
<odoo>
<record id="purge_menus_view" model="ir.ui.view">
<field name="model">cleanup.purge.wizard.menu</field>
<field name="inherit_id" ref="form_purge_wizard" />
<field name="mode">primary</field>
<field name="arch" type="xml">
<data/>
</field>
</record>
<record id="action_purge_menus" model="ir.actions.server">
<field name="name">Purge menus</field>
<field name="type">ir.actions.server</field>
<field name="state">code</field>
<field name="model_id" ref="database_cleanup.model_cleanup_purge_wizard_menu" />
<field name="code">action = self.get_wizard_action(cr, uid, context=context)</field>
</record>
<record id="action_purge_menus" model="ir.actions.server">
<field name="name">Purge menus</field>
<field name="type">ir.actions.server</field>
<field name="state">code</field>
<field name="model_id" ref="database_cleanup.model_cleanup_purge_wizard_menu" />
<field name="code">
action = env.get('cleanup.purge.wizard.menu').get_wizard_action()
</field>
</record>
<record id="purge_menu_line_tree" model="ir.ui.view">
<field name="model">cleanup.purge.line.menu</field>
<field name="inherit_id" ref="tree_purge_line" />
<field name="mode">primary</field>
<field name="arch" type="xml">
<data />
</field>
</record>
<record id="purge_menu_line_tree" model="ir.ui.view">
<field name="model">cleanup.purge.line.menu</field>
<field name="inherit_id" ref="tree_purge_line" />
<field name="mode">primary</field>
<field name="arch" type="xml">
<data />
</field>
</record>
<record id="action_purge_menu_line" model="ir.actions.server">
<field name="name">Purge</field>
<field name="type">ir.actions.server</field>
<field name="state">code</field>
<field name="model_id" ref="database_cleanup.model_cleanup_purge_line_menu" />
<field name="code">self.purge(cr, uid, context.get('active_ids', []), context)</field>
</record>
<record id="action_purge_menu_line" model="ir.actions.server">
<field name="name">Purge</field>
<field name="type">ir.actions.server</field>
<field name="state">code</field>
<field name="model_id" ref="database_cleanup.model_cleanup_purge_line_menu" />
<field name="code">
env.get('cleanup.purge.line.menu').purge()
</field>
</record>
<record id="action_purge_menu_line_value" model="ir.values">
<field name="name">Purge</field>
<field name="key">action</field>
<field name="key2">client_action_multi</field>
<field name="model">cleanup.purge.line.menu</field>
<field name="value" eval="'ir.actions.server,%d' % ref('database_cleanup.action_purge_menu_line')" />
</record>
</data>
</openerp>
<record id="action_purge_menu_line_value" model="ir.values">
<field name="name">Purge</field>
<field name="key">action</field>
<field name="key2">client_action_multi</field>
<field name="model">cleanup.purge.line.menu</field>
<field name="value" eval="'ir.actions.server,%d' % ref('database_cleanup.action_purge_menu_line')" />
</record>
</odoo>

85
database_cleanup/views/purge_models.xml

@ -1,47 +1,48 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="purge_models_view" model="ir.ui.view">
<field name="model">cleanup.purge.wizard.model</field>
<field name="inherit_id" ref="form_purge_wizard" />
<field name="mode">primary</field>
<field name="arch" type="xml">
<data />
</field>
</record>
<odoo>
<record id="purge_models_view" model="ir.ui.view">
<field name="model">cleanup.purge.wizard.model</field>
<field name="inherit_id" ref="form_purge_wizard" />
<field name="mode">primary</field>
<field name="arch" type="xml">
<data />
</field>
</record>
<record id="action_purge_models" model="ir.actions.server">
<field name="name">Purge models</field>
<field name="type">ir.actions.server</field>
<field name="state">code</field>
<field name="model_id" ref="database_cleanup.model_cleanup_purge_wizard_model" />
<field name="code">action = self.get_wizard_action(cr, uid, context=context)</field>
</record>
<record id="action_purge_models" model="ir.actions.server">
<field name="name">Purge models</field>
<field name="type">ir.actions.server</field>
<field name="state">code</field>
<field name="model_id" ref="database_cleanup.model_cleanup_purge_wizard_model" />
<field name="code">
action = env.get('cleanup.purge.wizard.model').get_wizard_action()
</field>
</record>
<record id="purge_model_line_tree" model="ir.ui.view">
<field name="model">cleanup.purge.line.model</field>
<field name="inherit_id" ref="tree_purge_line" />
<field name="mode">primary</field>
<field name="arch" type="xml">
<data />
</field>
</record>
<record id="purge_model_line_tree" model="ir.ui.view">
<field name="model">cleanup.purge.line.model</field>
<field name="inherit_id" ref="tree_purge_line" />
<field name="mode">primary</field>
<field name="arch" type="xml">
<data />
</field>
</record>
<record id="action_purge_model_line" model="ir.actions.server">
<field name="name">Purge</field>
<field name="type">ir.actions.server</field>
<field name="state">code</field>
<field name="model_id" ref="database_cleanup.model_cleanup_purge_line_model" />
<field name="code">self.purge(cr, uid, context.get('active_ids', []), context)</field>
</record>
<record id="action_purge_model_line" model="ir.actions.server">
<field name="name">Purge</field>
<field name="type">ir.actions.server</field>
<field name="state">code</field>
<field name="model_id" ref="database_cleanup.model_cleanup_purge_line_model" />
<field name="code">
env.get('cleanup.purge.line.model').purge()
</field>
</record>
<record id="action_purge_model_line_value" model="ir.values">
<field name="name">Purge</field>
<field name="key">action</field>
<field name="key2">client_action_multi</field>
<field name="model">cleanup.purge.line.model</field>
<field name="value" eval="'ir.actions.server,%d' % ref('database_cleanup.action_purge_model_line')" />
</record>
</data>
</openerp>
<record id="action_purge_model_line_value" model="ir.values">
<field name="name">Purge</field>
<field name="key">action</field>
<field name="key2">client_action_multi</field>
<field name="model">cleanup.purge.line.model</field>
<field name="value" eval="'ir.actions.server,%d' % ref('database_cleanup.action_purge_model_line')" />
</record>
</odoo>

85
database_cleanup/views/purge_modules.xml

@ -1,47 +1,48 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="purge_modules_view" model="ir.ui.view">
<field name="model">cleanup.purge.wizard.module</field>
<field name="inherit_id" ref="form_purge_wizard" />
<field name="mode">primary</field>
<field name="arch" type="xml">
<data />
</field>
</record>
<odoo>
<record id="purge_modules_view" model="ir.ui.view">
<field name="model">cleanup.purge.wizard.module</field>
<field name="inherit_id" ref="form_purge_wizard" />
<field name="mode">primary</field>
<field name="arch" type="xml">
<data />
</field>
</record>
<record id="action_purge_modules" model="ir.actions.server">
<field name="name">Purge modules</field>
<field name="type">ir.actions.server</field>
<field name="state">code</field>
<field name="model_id" ref="database_cleanup.model_cleanup_purge_wizard_module" />
<field name="code">action = self.get_wizard_action(cr, uid, context=context)</field>
</record>
<record id="action_purge_modules" model="ir.actions.server">
<field name="name">Purge modules</field>
<field name="type">ir.actions.server</field>
<field name="state">code</field>
<field name="model_id" ref="database_cleanup.model_cleanup_purge_wizard_module" />
<field name="code">
action = env.get('cleanup.purge.wizard.module').get_wizard_action()
</field>
</record>
<record id="purge_module_line_tree" model="ir.ui.view">
<field name="model">cleanup.purge.line.module</field>
<field name="inherit_id" ref="tree_purge_line" />
<field name="mode">primary</field>
<field name="arch" type="xml">
<data/>
</field>
</record>
<record id="purge_module_line_tree" model="ir.ui.view">
<field name="model">cleanup.purge.line.module</field>
<field name="inherit_id" ref="tree_purge_line" />
<field name="mode">primary</field>
<field name="arch" type="xml">
<data/>
</field>
</record>
<record id="action_purge_module_line" model="ir.actions.server">
<field name="name">Purge</field>
<field name="type">ir.actions.server</field>
<field name="state">code</field>
<field name="model_id" ref="database_cleanup.model_cleanup_purge_line_module" />
<field name="code">self.purge(cr, uid, context.get('active_ids', []), context)</field>
</record>
<record id="action_purge_module_line" model="ir.actions.server">
<field name="name">Purge</field>
<field name="type">ir.actions.server</field>
<field name="state">code</field>
<field name="model_id" ref="database_cleanup.model_cleanup_purge_line_module" />
<field name="code">
env.get('cleanup.purge.line.module').purge()
</field>
</record>
<record id="action_purge_module_line_value" model="ir.values">
<field name="name">Purge</field>
<field name="key">action</field>
<field name="key2">client_action_multi</field>
<field name="model">cleanup.purge.line.module</field>
<field name="value" eval="'ir.actions.server,%d' % ref('database_cleanup.action_purge_module_line')" />
</record>
</data>
</openerp>
<record id="action_purge_module_line_value" model="ir.values">
<field name="name">Purge</field>
<field name="key">action</field>
<field name="key2">client_action_multi</field>
<field name="model">cleanup.purge.line.module</field>
<field name="value" eval="'ir.actions.server,%d' % ref('database_cleanup.action_purge_module_line')" />
</record>
</odoo>

82
database_cleanup/views/purge_properties.xml

@ -1,49 +1,47 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="purge_property_view" model="ir.ui.view">
<field name="model">cleanup.purge.wizard.property</field>
<field name="inherit_id" ref="form_purge_wizard" />
<field name="mode">primary</field>
<field name="arch" type="xml">
<data />
</field>
</record>
<odoo>
<record id="purge_property_view" model="ir.ui.view">
<field name="model">cleanup.purge.wizard.property</field>
<field name="inherit_id" ref="form_purge_wizard" />
<field name="mode">primary</field>
<field name="arch" type="xml">
<data />
</field>
</record>
<record id="action_purge_property" model="ir.actions.server">
<field name="name">Purge properties</field>
<field name="type">ir.actions.server</field>
<field name="state">code</field>
<field name="model_id" ref="database_cleanup.model_cleanup_purge_wizard_property" />
<field name="code">action = self.get_wizard_action(cr, uid, context=context)</field>
</record>
<record id="action_purge_property" model="ir.actions.server">
<field name="name">Purge properties</field>
<field name="type">ir.actions.server</field>
<field name="state">code</field>
<field name="model_id" ref="database_cleanup.model_cleanup_purge_wizard_property" />
<field name="code">action = env.get('cleanup.purge.wizard.property').get_wizard_action()</field>
</record>
<record id="purge_property_line_tree" model="ir.ui.view">
<field name="model">cleanup.purge.line.property</field>
<field name="inherit_id" ref="tree_purge_line" />
<field name="mode">primary</field>
<field name="arch" type="xml">
<field name="name" position="after">
<field name="reason" />
</field>
<record id="purge_property_line_tree" model="ir.ui.view">
<field name="model">cleanup.purge.line.property</field>
<field name="inherit_id" ref="tree_purge_line" />
<field name="mode">primary</field>
<field name="arch" type="xml">
<field name="name" position="after">
<field name="reason" />
</field> </field>
</record>
</field>
</record>
<record id="action_purge_property_line" model="ir.actions.server">
<field name="name">Purge</field>
<field name="type">ir.actions.server</field>
<field name="state">code</field>
<field name="model_id" ref="database_cleanup.model_cleanup_purge_line_property" />
<field name="code">self.purge(cr, uid, context.get('active_ids', []), context)</field>
</record>
<record id="action_purge_property_line" model="ir.actions.server">
<field name="name">Purge</field>
<field name="type">ir.actions.server</field>
<field name="state">code</field>
<field name="model_id" ref="database_cleanup.model_cleanup_purge_line_property" />
<field name="code">env.get('cleanup.purge.line.property').purge()</field>
</record>
<record id="action_purge_property_line_value" model="ir.values">
<field name="name">Purge</field>
<field name="key">action</field>
<field name="key2">client_action_multi</field>
<field name="model">cleanup.purge.line.property</field>
<field name="value" eval="'ir.actions.server,%d' % ref('database_cleanup.action_purge_property_line')" />
</record>
<record id="action_purge_property_line_value" model="ir.values">
<field name="name">Purge</field>
<field name="key">action</field>
<field name="key2">client_action_multi</field>
<field name="model">cleanup.purge.line.property</field>
<field name="value" eval="'ir.actions.server,%d' % ref('database_cleanup.action_purge_property_line')" />
</record>
</data>
</openerp>
</odoo>

84
database_cleanup/views/purge_tables.xml

@ -1,46 +1,48 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="purge_tables_view" model="ir.ui.view">
<field name="model">cleanup.purge.wizard.table</field>
<field name="inherit_id" ref="form_purge_wizard" />
<field name="mode">primary</field>
<field name="arch" type="xml">
<data />
</field>
</record>
<odoo>
<record id="purge_tables_view" model="ir.ui.view">
<field name="model">cleanup.purge.wizard.table</field>
<field name="inherit_id" ref="form_purge_wizard" />
<field name="mode">primary</field>
<field name="arch" type="xml">
<data />
</field>
</record>
<record id="action_purge_tables" model="ir.actions.server">
<field name="name">Purge tables</field>
<field name="type">ir.actions.server</field>
<field name="state">code</field>
<field name="model_id" ref="database_cleanup.model_cleanup_purge_wizard_table" />
<field name="code">action = self.get_wizard_action(cr, uid, context=context)</field>
</record>
<record id="action_purge_tables" model="ir.actions.server">
<field name="name">Purge tables</field>
<field name="type">ir.actions.server</field>
<field name="state">code</field>
<field name="model_id" ref="database_cleanup.model_cleanup_purge_wizard_table" />
<field name="code">
action = env.get('cleanup.purge.wizard.table').get_wizard_action()
</field>
</record>
<record id="purge_table_line_tree" model="ir.ui.view">
<field name="model">cleanup.purge.line.table</field>
<field name="inherit_id" ref="tree_purge_line" />
<field name="mode">primary</field>
<field name="arch" type="xml">
<data />
</field>
</record>
<record id="purge_table_line_tree" model="ir.ui.view">
<field name="model">cleanup.purge.line.table</field>
<field name="inherit_id" ref="tree_purge_line" />
<field name="mode">primary</field>
<field name="arch" type="xml">
<data />
</field>
</record>
<record id="action_purge_table_line" model="ir.actions.server">
<field name="name">Purge</field>
<field name="type">ir.actions.server</field>
<field name="state">code</field>
<field name="model_id" ref="database_cleanup.model_cleanup_purge_line_table" />
<field name="code">self.purge(cr, uid, context.get('active_ids', []), context)</field>
</record>
<record id="action_purge_table_line" model="ir.actions.server">
<field name="name">Purge</field>
<field name="type">ir.actions.server</field>
<field name="state">code</field>
<field name="model_id" ref="database_cleanup.model_cleanup_purge_line_table" />
<field name="code">
env.get('cleanup.purge.line.table').purge()
</field>
</record>
<record id="action_purge_table_line_value" model="ir.values">
<field name="name">Purge</field>
<field name="key">action</field>
<field name="key2">client_action_multi</field>
<field name="model">cleanup.purge.line.table</field>
<field name="value" eval="'ir.actions.server,%d' % ref('database_cleanup.action_purge_table_line')" />
</record>
</data>
</openerp>
<record id="action_purge_table_line_value" model="ir.values">
<field name="name">Purge</field>
<field name="key">action</field>
<field name="key2">client_action_multi</field>
<field name="model">cleanup.purge.line.table</field>
<field name="value" eval="'ir.actions.server,%d' % ref('database_cleanup.action_purge_table_line')" />
</record>
</odoo>

84
database_cleanup/views/purge_wizard.xml

@ -1,44 +1,42 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="form_purge_wizard" model="ir.ui.view">
<field name="model">cleanup.purge.wizard</field>
<field name="arch" type="xml">
<form>
<header>
<button type="object" name="purge_all" string="Purge all" class="oe_highlight" />
<button type="object" name="select_lines" string="Select lines" />
</header>
<field name="purge_line_ids" attrs="{'invisible': [('purge_line_ids', '=', [])]}">
<form>
<group>
<field name="name" />
<field name="purged" />
</group>
<footer>
<button type="object" name="purge" class="oe_highlight"
string="Purge"
attrs="{'invisible': [('purged', '=', True)]}"/>
</footer>
</form>
</field>
<div attrs="{'invisible': [('purge_line_ids', '!=', [])]}">
Nothing found to clean up.
</div>
</form>
</field>
</record>
<record id="tree_purge_line" model="ir.ui.view">
<field name="model">cleanup.purge.line</field>
<field name="arch" type="xml">
<tree string="Purge models" delete="false" create="false">
<field name="name" />
<field name="purged" />
<button type="object" name="purge"
icon="gtk-cancel" string="Purge this model"
attrs="{'invisible': [('purged', '=', True)]}"/>
</tree>
</field>
</record>
</data>
</openerp>
<odoo>
<record id="form_purge_wizard" model="ir.ui.view">
<field name="model">cleanup.purge.wizard</field>
<field name="arch" type="xml">
<form>
<header>
<button type="object" name="purge_all" string="Purge all" class="oe_highlight" />
<button type="object" name="select_lines" string="Select lines" />
</header>
<div attrs="{'invisible': [('purge_line_ids', '!=', [])]}">
Nothing found to clean up.
</div>
<field name="purge_line_ids" attrs="{'invisible': [('purge_line_ids', '=', [])]}">
<form>
<group>
<field name="name" />
<field name="purged" />
</group>
<footer>
<button type="object" name="purge" class="oe_highlight"
string="Purge"
attrs="{'invisible': [('purged', '=', True)]}"/>
</footer>
</form>
</field>
</form>
</field>
</record>
<record id="tree_purge_line" model="ir.ui.view">
<field name="model">cleanup.purge.line</field>
<field name="arch" type="xml">
<tree string="Purge models" delete="false" create="false">
<field name="name" />
<field name="purged" />
<button type="object" name="purge"
icon="gtk-cancel" string="Purge this model"
attrs="{'invisible': [('purged', '=', True)]}"/>
</tree>
</field>
</record>
</odoo>
Loading…
Cancel
Save