From e7eb2f894cb4bcceebb669c1013d5cc088b952aa Mon Sep 17 00:00:00 2001
From: Eric Antones <eantones@nuobit.com>
Date: Wed, 21 Jun 2017 14:05:52 +0200
Subject: [PATCH] [MIG] database_cleanup: Migration to version 10.0

Using new base model inheritance.
---
 database_cleanup/README.rst                   |   8 +-
 database_cleanup/__manifest__.py              |   5 +-
 database_cleanup/i18n/am.po                   |   2 +-
 database_cleanup/i18n/ca.po                   | 132 ++++++------------
 database_cleanup/i18n/database_cleanup.pot    |   2 +-
 database_cleanup/i18n/de.po                   |   2 +-
 database_cleanup/i18n/el_GR.po                |   2 +-
 database_cleanup/i18n/es.po                   |   2 +-
 database_cleanup/i18n/es_ES.po                |   2 +-
 database_cleanup/i18n/fi.po                   |   2 +-
 database_cleanup/i18n/fr.po                   |   2 +-
 database_cleanup/i18n/fr_CA.po                |   2 +-
 database_cleanup/i18n/gl.po                   |   2 +-
 database_cleanup/i18n/hr.po                   |   2 +-
 database_cleanup/i18n/hr_HR.po                |   2 +-
 database_cleanup/i18n/it.po                   |   2 +-
 database_cleanup/i18n/nl.po                   |   2 +-
 database_cleanup/i18n/pt.po                   |   2 +-
 database_cleanup/i18n/pt_BR.po                |   2 +-
 database_cleanup/i18n/pt_PT.po                |   2 +-
 database_cleanup/i18n/ru.po                   |   2 +-
 database_cleanup/i18n/sl.po                   |   2 +-
 database_cleanup/i18n/tr.po                   |   2 +-
 database_cleanup/i18n/zh_CN.po                |   2 +-
 database_cleanup/models/purge_columns.py      |  19 +--
 database_cleanup/models/purge_data.py         |  13 +-
 database_cleanup/models/purge_menus.py        |  16 ++-
 database_cleanup/models/purge_models.py       |  49 ++++---
 database_cleanup/models/purge_modules.py      |  19 ++-
 database_cleanup/models/purge_tables.py       |  22 +--
 database_cleanup/models/purge_wizard.py       |   6 +-
 .../tests/test_database_cleanup.py            |  24 ++--
 database_cleanup/views/menu.xml               | 106 +++++++-------
 database_cleanup/views/purge_columns.xml      |  88 ++++++------
 database_cleanup/views/purge_data.xml         |  88 ++++++------
 database_cleanup/views/purge_menus.xml        |  85 +++++------
 database_cleanup/views/purge_models.xml       |  85 +++++------
 database_cleanup/views/purge_modules.xml      |  85 +++++------
 database_cleanup/views/purge_tables.xml       |  84 +++++------
 database_cleanup/views/purge_wizard.xml       |  78 +++++------
 40 files changed, 518 insertions(+), 536 deletions(-)

diff --git a/database_cleanup/README.rst b/database_cleanup/README.rst
index 42222ae545c..72611c6e4e9 100644
--- a/database_cleanup/README.rst
+++ b/database_cleanup/README.rst
@@ -6,13 +6,13 @@
 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
-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
 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,
 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
     :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
 ===========
diff --git a/database_cleanup/__manifest__.py b/database_cleanup/__manifest__.py
index 036988cf5cf..2b91bcb8adf 100644
--- a/database_cleanup/__manifest__.py
+++ b/database_cleanup/__manifest__.py
@@ -3,7 +3,7 @@
 # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
 {
     'name': 'Database cleanup',
-    'version': '9.0.1.0.0',
+    'version': '10.0.1.0.0',
     'author': "Therp BV,Odoo Community Association (OCA)",
     'depends': ['base'],
     'license': 'AGPL-3',
@@ -18,5 +18,6 @@
         'views/purge_data.xml',
         'views/menu.xml',
     ],
-    'installable': False,
+    'installable': True,
+    "application": True,
 }
diff --git a/database_cleanup/i18n/am.po b/database_cleanup/i18n/am.po
index fc4c62c72fc..d96faf1c078 100644
--- a/database_cleanup/i18n/am.po
+++ b/database_cleanup/i18n/am.po
@@ -6,7 +6,7 @@
 # OCA Transbot <transbot@odoo-community.org>, 2016
 msgid ""
 msgstr ""
-"Project-Id-Version: Odoo Server 9.0c\n"
+"Project-Id-Version: Odoo Server 10.0\n"
 "Report-Msgid-Bugs-To: \n"
 "POT-Creation-Date: 2016-09-10 02:53+0000\n"
 "PO-Revision-Date: 2016-09-10 02:53+0000\n"
diff --git a/database_cleanup/i18n/ca.po b/database_cleanup/i18n/ca.po
index 31d2c106e84..531552afb8b 100644
--- a/database_cleanup/i18n/ca.po
+++ b/database_cleanup/i18n/ca.po
@@ -1,4 +1,3 @@
-# Translation of Odoo Server.
 # This file contains the translation of the following modules:
 # * database_cleanup
 # 
@@ -6,7 +5,7 @@
 # OCA Transbot <transbot@odoo-community.org>, 2016
 msgid ""
 msgstr ""
-"Project-Id-Version: Odoo Server 9.0c\n"
+"Project-Id-Version: Odoo Server 10.0c\n"
 "Report-Msgid-Bugs-To: \n"
 "POT-Creation-Date: 2016-09-10 02:53+0000\n"
 "PO-Revision-Date: 2016-09-10 02:53+0000\n"
@@ -21,7 +20,7 @@ msgstr ""
 #. module: database_cleanup
 #: model:ir.model.fields,field_description:database_cleanup.field_cleanup_purge_wizard_column_purge_line_ids
 msgid "Columns to purge"
-msgstr ""
+msgstr "Columnes a purgar"
 
 #. module: database_cleanup
 #: model:ir.model.fields,field_description:database_cleanup.field_cleanup_purge_line_column_create_uid
@@ -58,17 +57,17 @@ msgstr "Creat el"
 #. module: database_cleanup
 #: model:ir.model.fields,field_description:database_cleanup.field_cleanup_purge_line_data_data_id
 msgid "Data entry"
-msgstr ""
+msgstr "Entrada de dades"
 
 #. module: database_cleanup
 #: model:ir.model.fields,field_description:database_cleanup.field_cleanup_purge_wizard_data_purge_line_ids
 msgid "Data to purge"
-msgstr ""
+msgstr "Dades a purgar"
 
 #. module: database_cleanup
 #: model:ir.ui.menu,name:database_cleanup.menu_database_cleanup
 msgid "Database cleanup"
-msgstr ""
+msgstr "Neteja de la base de dades"
 
 #. module: database_cleanup
 #: model:ir.model.fields,field_description:database_cleanup.field_cleanup_purge_line_column_display_name
@@ -86,7 +85,7 @@ msgstr ""
 #: model:ir.model.fields,field_description:database_cleanup.field_cleanup_purge_wizard_module_display_name
 #: model:ir.model.fields,field_description:database_cleanup.field_cleanup_purge_wizard_table_display_name
 msgid "Display Name"
-msgstr ""
+msgstr "Nom a mostrar"
 
 #. module: database_cleanup
 #: model:ir.model.fields,field_description:database_cleanup.field_cleanup_purge_line_column_id
@@ -122,7 +121,7 @@ msgstr "ID"
 #: model:ir.model.fields,field_description:database_cleanup.field_cleanup_purge_wizard_module___last_update
 #: model:ir.model.fields,field_description:database_cleanup.field_cleanup_purge_wizard_table___last_update
 msgid "Last Modified on"
-msgstr ""
+msgstr "Darrera modificació el"
 
 #. module: database_cleanup
 #: model:ir.model.fields,field_description:database_cleanup.field_cleanup_purge_line_column_write_uid
@@ -159,32 +158,32 @@ msgstr "Darrera Actualització el"
 #. module: database_cleanup
 #: model:ir.model.fields,field_description:database_cleanup.field_cleanup_purge_line_menu_menu_id
 msgid "Menu entry"
-msgstr ""
+msgstr "Entrada de menú"
 
 #. module: database_cleanup
 #: model:ir.model.fields,field_description:database_cleanup.field_cleanup_purge_wizard_menu_purge_line_ids
 msgid "Menus to purge"
-msgstr ""
+msgstr "Menús a purgar"
 
 #. module: database_cleanup
 #: model:ir.model.fields,field_description:database_cleanup.field_cleanup_purge_line_column_model_id
 msgid "Model"
-msgstr ""
+msgstr "Model"
 
 #. module: database_cleanup
 #: model:ir.model,name:database_cleanup.model_ir_model
 msgid "Models"
-msgstr ""
+msgstr "Models"
 
 #. module: database_cleanup
 #: model:ir.model.fields,field_description:database_cleanup.field_cleanup_purge_wizard_model_purge_line_ids
 msgid "Models to purge"
-msgstr ""
+msgstr "Models a purgar"
 
 #. module: database_cleanup
 #: model:ir.model.fields,field_description:database_cleanup.field_cleanup_purge_wizard_module_purge_line_ids
 msgid "Modules to purge"
-msgstr ""
+msgstr "Mòduls a purgar"
 
 #. module: database_cleanup
 #: model:ir.model.fields,field_description:database_cleanup.field_cleanup_purge_line_column_name
@@ -195,43 +194,43 @@ msgstr ""
 #: model:ir.model.fields,field_description:database_cleanup.field_cleanup_purge_line_name
 #: model:ir.model.fields,field_description:database_cleanup.field_cleanup_purge_line_table_name
 msgid "Name"
-msgstr ""
+msgstr "Nom"
 
 #. module: database_cleanup
 #: code:addons/database_cleanup/models/purge_menus.py:44
 #, python-format
 msgid "No dangling menu entries found"
-msgstr ""
+msgstr "No s'han trobat entrades de menú penjades"
 
 #. module: database_cleanup
 #: code:addons/database_cleanup/models/purge_modules.py:79
 #, python-format
 msgid "No modules found to purge"
-msgstr ""
+msgstr "No s'han trobat mòduls per purgar"
 
 #. module: database_cleanup
 #: code:addons/database_cleanup/models/purge_columns.py:123
 #, python-format
 msgid "No orphaned columns found"
-msgstr ""
+msgstr "No s'han trobat columnes orfes"
 
 #. module: database_cleanup
 #: code:addons/database_cleanup/models/purge_data.py:64
 #, python-format
 msgid "No orphaned data entries found"
-msgstr ""
+msgstr "No s'han trobat entrades de dades orfes"
 
 #. module: database_cleanup
 #: code:addons/database_cleanup/models/purge_models.py:115
 #, python-format
 msgid "No orphaned models found"
-msgstr ""
+msgstr "No s'han trobat models orfes"
 
 #. module: database_cleanup
 #: code:addons/database_cleanup/models/purge_tables.py:102
 #, python-format
 msgid "No orphaned tables found"
-msgstr ""
+msgstr "No s'han trobat taules orfes"
 
 #. module: database_cleanup
 #: model:ir.actions.server,name:database_cleanup.action_purge_column_line
@@ -242,7 +241,7 @@ msgstr ""
 #: model:ir.actions.server,name:database_cleanup.action_purge_table_line
 #: model:ir.ui.view,arch_db:database_cleanup.form_purge_wizard
 msgid "Purge"
-msgstr ""
+msgstr "Purgar"
 
 #. module: database_cleanup
 #: model:ir.model.fields,field_description:database_cleanup.field_cleanup_purge_line_column_wizard_id
@@ -252,39 +251,34 @@ msgstr ""
 #: model:ir.model.fields,field_description:database_cleanup.field_cleanup_purge_line_module_wizard_id
 #: model:ir.model.fields,field_description:database_cleanup.field_cleanup_purge_line_table_wizard_id
 msgid "Purge Wizard"
-msgstr ""
+msgstr "Assistent de purga"
 
 #. module: database_cleanup
 #: model:ir.ui.view,arch_db:database_cleanup.form_purge_wizard
 msgid "Purge all"
-msgstr ""
+msgstr "Purgar tot"
 
 #. module: database_cleanup
 #: model:ir.actions.server,name:database_cleanup.action_purge_columns
 #: model:ir.model,name:database_cleanup.model_cleanup_purge_wizard_column
 msgid "Purge columns"
-msgstr ""
+msgstr "Purgar columnes"
 
 #. module: database_cleanup
 #: model:ir.model,name:database_cleanup.model_cleanup_purge_wizard_data
 msgid "Purge data"
-msgstr ""
+msgstr "Purgar dades"
 
 #. module: database_cleanup
 #: model:ir.actions.server,name:database_cleanup.action_purge_data
 msgid "Purge data entries that refer to missing resources"
-msgstr ""
-
-#. module: database_cleanup
-#: 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
 #: model:ir.actions.server,name:database_cleanup.action_purge_menus
 #: model:ir.model,name:database_cleanup.model_cleanup_purge_wizard_menu
 msgid "Purge menus"
-msgstr ""
+msgstr "Purgar menús"
 
 #. module: database_cleanup
 #: model:ir.actions.server,name:database_cleanup.action_purge_models
@@ -292,59 +286,54 @@ msgstr ""
 #: model:ir.model,name:database_cleanup.model_cleanup_purge_wizard_model
 #: model:ir.ui.view,arch_db:database_cleanup.tree_purge_line
 msgid "Purge models"
-msgstr ""
+msgstr "Purgar models"
 
 #. module: database_cleanup
 #: model:ir.actions.server,name:database_cleanup.action_purge_modules
 #: model:ir.model,name:database_cleanup.model_cleanup_purge_wizard_module
 msgid "Purge modules"
-msgstr ""
+msgstr "Purgar mòduls"
 
 #. module: database_cleanup
 #: model:ir.ui.menu,name:database_cleanup.menu_purge_columns
 msgid "Purge obsolete columns"
-msgstr ""
+msgstr "Purgar columnes obsoletes"
 
 #. module: database_cleanup
 #: model:ir.ui.menu,name:database_cleanup.menu_purge_data
 msgid "Purge obsolete data entries"
-msgstr ""
+msgstr "Purgar entrades de dades obsoletes"
 
 #. module: database_cleanup
 #: model:ir.ui.menu,name:database_cleanup.menu_purge_menus
 msgid "Purge obsolete menu entries"
-msgstr ""
+msgstr "Purgar entrades de menú obsoletes"
 
 #. module: database_cleanup
 #: model:ir.ui.menu,name:database_cleanup.menu_purge_models
 msgid "Purge obsolete models"
-msgstr ""
+msgstr "Purgar models obsolets"
 
 #. module: database_cleanup
 #: model:ir.ui.menu,name:database_cleanup.menu_purge_modules
 msgid "Purge obsolete modules"
-msgstr ""
+msgstr "Purgar mòduls obsolets"
 
 #. module: database_cleanup
 #: model:ir.ui.menu,name:database_cleanup.menu_purge_tables
 msgid "Purge obsolete tables"
-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
 #: model:ir.actions.server,name:database_cleanup.action_purge_tables
 #: model:ir.model,name:database_cleanup.model_cleanup_purge_wizard_table
 msgid "Purge tables"
-msgstr ""
+msgstr "Purgar taules"
 
 #. module: database_cleanup
 #: model:ir.ui.view,arch_db:database_cleanup.tree_purge_line
 msgid "Purge this model"
-msgstr ""
+msgstr "Purgar aquest model"
 
 #. module: database_cleanup
 #: model:ir.model.fields,field_description:database_cleanup.field_cleanup_purge_line_column_purged
@@ -355,60 +344,21 @@ 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_table_purged
 msgid "Purged"
-msgstr ""
+msgstr "Purgat"
 
 #. module: database_cleanup
 #: model:ir.ui.view,arch_db:database_cleanup.form_purge_wizard
 msgid "Select lines"
-msgstr ""
+msgstr "Seleccionar línies"
 
 #. module: database_cleanup
 #: code:addons/database_cleanup/models/purge_wizard.py:73
 #, python-format
 msgid "Select lines to purge"
-msgstr ""
+msgstr "Seleccionar línies a purgar"
 
 #. module: database_cleanup
 #: model:ir.model.fields,field_description:database_cleanup.field_cleanup_purge_wizard_table_purge_line_ids
 msgid "Tables to purge"
-msgstr ""
-
-#. module: database_cleanup
-#: 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_purge_line
-msgid "cleanup.purge.line"
-msgstr ""
+msgstr "Taules a purgar"
 
-#. 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 ""
diff --git a/database_cleanup/i18n/database_cleanup.pot b/database_cleanup/i18n/database_cleanup.pot
index 1dbecdeebab..237f7a21b14 100644
--- a/database_cleanup/i18n/database_cleanup.pot
+++ b/database_cleanup/i18n/database_cleanup.pot
@@ -4,7 +4,7 @@
 #
 msgid ""
 msgstr ""
-"Project-Id-Version: Odoo Server 8.0\n"
+"Project-Id-Version: Odoo Server 10.0\n"
 "Report-Msgid-Bugs-To: \n"
 "POT-Creation-Date: 2015-08-11 06:45+0000\n"
 "PO-Revision-Date: 2015-08-11 06:45+0000\n"
diff --git a/database_cleanup/i18n/de.po b/database_cleanup/i18n/de.po
index d0ed8b308b7..043cf93ce13 100644
--- a/database_cleanup/i18n/de.po
+++ b/database_cleanup/i18n/de.po
@@ -7,7 +7,7 @@
 # Ermin Trevisan <trevi@twanda.com>, 2016
 msgid ""
 msgstr ""
-"Project-Id-Version: Odoo Server 9.0c\n"
+"Project-Id-Version: Odoo Server 10.0\n"
 "Report-Msgid-Bugs-To: \n"
 "POT-Creation-Date: 2016-09-10 02:53+0000\n"
 "PO-Revision-Date: 2016-09-10 02:53+0000\n"
diff --git a/database_cleanup/i18n/el_GR.po b/database_cleanup/i18n/el_GR.po
index e05221e3fb8..292822cab6f 100644
--- a/database_cleanup/i18n/el_GR.po
+++ b/database_cleanup/i18n/el_GR.po
@@ -6,7 +6,7 @@
 # OCA Transbot <transbot@odoo-community.org>, 2016
 msgid ""
 msgstr ""
-"Project-Id-Version: Odoo Server 9.0c\n"
+"Project-Id-Version: Odoo Server 10.0\n"
 "Report-Msgid-Bugs-To: \n"
 "POT-Creation-Date: 2016-09-10 02:53+0000\n"
 "PO-Revision-Date: 2016-09-10 02:53+0000\n"
diff --git a/database_cleanup/i18n/es.po b/database_cleanup/i18n/es.po
index b73a85bf012..3a79bf7cddb 100644
--- a/database_cleanup/i18n/es.po
+++ b/database_cleanup/i18n/es.po
@@ -6,7 +6,7 @@
 # OCA Transbot <transbot@odoo-community.org>, 2016
 msgid ""
 msgstr ""
-"Project-Id-Version: Odoo Server 9.0c\n"
+"Project-Id-Version: Odoo Server 10.0\n"
 "Report-Msgid-Bugs-To: \n"
 "POT-Creation-Date: 2016-09-10 02:53+0000\n"
 "PO-Revision-Date: 2016-09-10 02:53+0000\n"
diff --git a/database_cleanup/i18n/es_ES.po b/database_cleanup/i18n/es_ES.po
index 9c32e5b0701..d8d7e068ea1 100644
--- a/database_cleanup/i18n/es_ES.po
+++ b/database_cleanup/i18n/es_ES.po
@@ -6,7 +6,7 @@
 # OCA Transbot <transbot@odoo-community.org>, 2016
 msgid ""
 msgstr ""
-"Project-Id-Version: Odoo Server 9.0c\n"
+"Project-Id-Version: Odoo Server 10.0\n"
 "Report-Msgid-Bugs-To: \n"
 "POT-Creation-Date: 2016-09-10 02:53+0000\n"
 "PO-Revision-Date: 2016-09-10 02:53+0000\n"
diff --git a/database_cleanup/i18n/fi.po b/database_cleanup/i18n/fi.po
index d53f2acd580..f8b230aea3d 100644
--- a/database_cleanup/i18n/fi.po
+++ b/database_cleanup/i18n/fi.po
@@ -6,7 +6,7 @@
 # OCA Transbot <transbot@odoo-community.org>, 2016
 msgid ""
 msgstr ""
-"Project-Id-Version: Odoo Server 9.0c\n"
+"Project-Id-Version: Odoo Server 10.0\n"
 "Report-Msgid-Bugs-To: \n"
 "POT-Creation-Date: 2016-07-09 10:34+0000\n"
 "PO-Revision-Date: 2016-07-09 10:34+0000\n"
diff --git a/database_cleanup/i18n/fr.po b/database_cleanup/i18n/fr.po
index 097b432dc46..7085acee91f 100644
--- a/database_cleanup/i18n/fr.po
+++ b/database_cleanup/i18n/fr.po
@@ -6,7 +6,7 @@
 # OCA Transbot <transbot@odoo-community.org>, 2016
 msgid ""
 msgstr ""
-"Project-Id-Version: Odoo Server 9.0c\n"
+"Project-Id-Version: Odoo Server 10.0\n"
 "Report-Msgid-Bugs-To: \n"
 "POT-Creation-Date: 2016-09-10 02:53+0000\n"
 "PO-Revision-Date: 2016-09-10 02:53+0000\n"
diff --git a/database_cleanup/i18n/fr_CA.po b/database_cleanup/i18n/fr_CA.po
index 26df3a5eebf..96069a78e0a 100644
--- a/database_cleanup/i18n/fr_CA.po
+++ b/database_cleanup/i18n/fr_CA.po
@@ -6,7 +6,7 @@
 # OCA Transbot <transbot@odoo-community.org>, 2016
 msgid ""
 msgstr ""
-"Project-Id-Version: Odoo Server 9.0c\n"
+"Project-Id-Version: Odoo Server 10.0\n"
 "Report-Msgid-Bugs-To: \n"
 "POT-Creation-Date: 2016-07-09 10:34+0000\n"
 "PO-Revision-Date: 2016-07-09 10:34+0000\n"
diff --git a/database_cleanup/i18n/gl.po b/database_cleanup/i18n/gl.po
index 67a2a1e9cc9..e2861c8dce3 100644
--- a/database_cleanup/i18n/gl.po
+++ b/database_cleanup/i18n/gl.po
@@ -6,7 +6,7 @@
 # OCA Transbot <transbot@odoo-community.org>, 2016
 msgid ""
 msgstr ""
-"Project-Id-Version: Odoo Server 9.0c\n"
+"Project-Id-Version: Odoo Server 10.0\n"
 "Report-Msgid-Bugs-To: \n"
 "POT-Creation-Date: 2016-09-10 02:53+0000\n"
 "PO-Revision-Date: 2016-09-10 02:53+0000\n"
diff --git a/database_cleanup/i18n/hr.po b/database_cleanup/i18n/hr.po
index 6173859992e..1c666863525 100644
--- a/database_cleanup/i18n/hr.po
+++ b/database_cleanup/i18n/hr.po
@@ -6,7 +6,7 @@
 # Bole <bole@dajmi5.com>, 2016
 msgid ""
 msgstr ""
-"Project-Id-Version: Odoo Server 9.0c\n"
+"Project-Id-Version: Odoo Server 10.0\n"
 "Report-Msgid-Bugs-To: \n"
 "POT-Creation-Date: 2016-07-09 10:34+0000\n"
 "PO-Revision-Date: 2016-07-09 10:34+0000\n"
diff --git a/database_cleanup/i18n/hr_HR.po b/database_cleanup/i18n/hr_HR.po
index 3acfee250bb..8f96e21d8ea 100644
--- a/database_cleanup/i18n/hr_HR.po
+++ b/database_cleanup/i18n/hr_HR.po
@@ -6,7 +6,7 @@
 # Bole <bole@dajmi5.com>, 2016
 msgid ""
 msgstr ""
-"Project-Id-Version: Odoo Server 9.0c\n"
+"Project-Id-Version: Odoo Server 10.0\n"
 "Report-Msgid-Bugs-To: \n"
 "POT-Creation-Date: 2016-07-09 10:34+0000\n"
 "PO-Revision-Date: 2016-07-09 10:34+0000\n"
diff --git a/database_cleanup/i18n/it.po b/database_cleanup/i18n/it.po
index d83f608c379..b857fc1ae2c 100644
--- a/database_cleanup/i18n/it.po
+++ b/database_cleanup/i18n/it.po
@@ -6,7 +6,7 @@
 # OCA Transbot <transbot@odoo-community.org>, 2016
 msgid ""
 msgstr ""
-"Project-Id-Version: Odoo Server 9.0c\n"
+"Project-Id-Version: Odoo Server 10.0\n"
 "Report-Msgid-Bugs-To: \n"
 "POT-Creation-Date: 2016-07-09 10:34+0000\n"
 "PO-Revision-Date: 2016-07-09 10:34+0000\n"
diff --git a/database_cleanup/i18n/nl.po b/database_cleanup/i18n/nl.po
index c15d072723b..ca87e4b6f43 100644
--- a/database_cleanup/i18n/nl.po
+++ b/database_cleanup/i18n/nl.po
@@ -6,7 +6,7 @@
 # OCA Transbot <transbot@odoo-community.org>, 2016
 msgid ""
 msgstr ""
-"Project-Id-Version: Odoo Server 9.0c\n"
+"Project-Id-Version: Odoo Server 10.0\n"
 "Report-Msgid-Bugs-To: \n"
 "POT-Creation-Date: 2016-09-10 02:53+0000\n"
 "PO-Revision-Date: 2016-09-10 02:53+0000\n"
diff --git a/database_cleanup/i18n/pt.po b/database_cleanup/i18n/pt.po
index b1404f46a86..397ef4317cf 100644
--- a/database_cleanup/i18n/pt.po
+++ b/database_cleanup/i18n/pt.po
@@ -6,7 +6,7 @@
 # OCA Transbot <transbot@odoo-community.org>, 2016
 msgid ""
 msgstr ""
-"Project-Id-Version: Odoo Server 9.0c\n"
+"Project-Id-Version: Odoo Server 10.0\n"
 "Report-Msgid-Bugs-To: \n"
 "POT-Creation-Date: 2016-09-10 02:53+0000\n"
 "PO-Revision-Date: 2016-09-10 02:53+0000\n"
diff --git a/database_cleanup/i18n/pt_BR.po b/database_cleanup/i18n/pt_BR.po
index d5ea499727e..e0444c938d2 100644
--- a/database_cleanup/i18n/pt_BR.po
+++ b/database_cleanup/i18n/pt_BR.po
@@ -6,7 +6,7 @@
 # OCA Transbot <transbot@odoo-community.org>, 2016
 msgid ""
 msgstr ""
-"Project-Id-Version: Odoo Server 9.0c\n"
+"Project-Id-Version: Odoo Server 10.0\n"
 "Report-Msgid-Bugs-To: \n"
 "POT-Creation-Date: 2016-08-17 00:56+0000\n"
 "PO-Revision-Date: 2016-08-17 00:56+0000\n"
diff --git a/database_cleanup/i18n/pt_PT.po b/database_cleanup/i18n/pt_PT.po
index 16ac14a2574..83b26ed21f8 100644
--- a/database_cleanup/i18n/pt_PT.po
+++ b/database_cleanup/i18n/pt_PT.po
@@ -6,7 +6,7 @@
 # OCA Transbot <transbot@odoo-community.org>, 2016
 msgid ""
 msgstr ""
-"Project-Id-Version: Odoo Server 9.0c\n"
+"Project-Id-Version: Odoo Server 10.0\n"
 "Report-Msgid-Bugs-To: \n"
 "POT-Creation-Date: 2016-09-10 02:53+0000\n"
 "PO-Revision-Date: 2016-09-10 02:53+0000\n"
diff --git a/database_cleanup/i18n/ru.po b/database_cleanup/i18n/ru.po
index 1142570f8bb..eadc58c17e8 100644
--- a/database_cleanup/i18n/ru.po
+++ b/database_cleanup/i18n/ru.po
@@ -6,7 +6,7 @@
 # OCA Transbot <transbot@odoo-community.org>, 2016
 msgid ""
 msgstr ""
-"Project-Id-Version: Odoo Server 9.0c\n"
+"Project-Id-Version: Odoo Server 10.0\n"
 "Report-Msgid-Bugs-To: \n"
 "POT-Creation-Date: 2016-07-09 10:34+0000\n"
 "PO-Revision-Date: 2016-07-09 10:34+0000\n"
diff --git a/database_cleanup/i18n/sl.po b/database_cleanup/i18n/sl.po
index 9cc69678a94..a2e4d0eee88 100644
--- a/database_cleanup/i18n/sl.po
+++ b/database_cleanup/i18n/sl.po
@@ -6,7 +6,7 @@
 # OCA Transbot <transbot@odoo-community.org>, 2016
 msgid ""
 msgstr ""
-"Project-Id-Version: Odoo Server 9.0c\n"
+"Project-Id-Version: Odoo Server 10.0\n"
 "Report-Msgid-Bugs-To: \n"
 "POT-Creation-Date: 2016-09-10 02:53+0000\n"
 "PO-Revision-Date: 2016-09-10 02:53+0000\n"
diff --git a/database_cleanup/i18n/tr.po b/database_cleanup/i18n/tr.po
index 29fc1de20d9..3cc26e41218 100644
--- a/database_cleanup/i18n/tr.po
+++ b/database_cleanup/i18n/tr.po
@@ -6,7 +6,7 @@
 # OCA Transbot <transbot@odoo-community.org>, 2016
 msgid ""
 msgstr ""
-"Project-Id-Version: Odoo Server 9.0c\n"
+"Project-Id-Version: Odoo Server 10.0\n"
 "Report-Msgid-Bugs-To: \n"
 "POT-Creation-Date: 2016-07-09 10:34+0000\n"
 "PO-Revision-Date: 2016-07-09 10:34+0000\n"
diff --git a/database_cleanup/i18n/zh_CN.po b/database_cleanup/i18n/zh_CN.po
index 22913368576..6deaf96353a 100644
--- a/database_cleanup/i18n/zh_CN.po
+++ b/database_cleanup/i18n/zh_CN.po
@@ -6,7 +6,7 @@
 # Jeffery Chenn <jeffery9@gmail.com>, 2016
 msgid ""
 msgstr ""
-"Project-Id-Version: Odoo Server 9.0c\n"
+"Project-Id-Version: Odoo Server 10.0\n"
 "Report-Msgid-Bugs-To: \n"
 "POT-Creation-Date: 2016-08-31 11:58+0000\n"
 "PO-Revision-Date: 2016-08-31 11:58+0000\n"
diff --git a/database_cleanup/models/purge_columns.py b/database_cleanup/models/purge_columns.py
index 3a3718c214b..be291891330 100644
--- a/database_cleanup/models/purge_columns.py
+++ b/database_cleanup/models/purge_columns.py
@@ -1,8 +1,8 @@
 # -*- coding: utf-8 -*-
 # © 2014-2016 Therp BV <http://therp.nl>
 # 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
 
 
@@ -20,7 +20,12 @@ def purge(self):
         """
         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:
                 continue
             model_pool = self.env[line.model_id.model]
@@ -71,12 +76,10 @@ def get_orphaned_columns(self, model_pools):
         of fields which have been removed
         """
         columns = list(set([
-            column
+            column.name
             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 += self.blacklist.get(model_pools[0]._table, [])
diff --git a/database_cleanup/models/purge_data.py b/database_cleanup/models/purge_data.py
index 9e1817ff808..f7ca49dee9b 100644
--- a/database_cleanup/models/purge_data.py
+++ b/database_cleanup/models/purge_data.py
@@ -1,8 +1,8 @@
 # -*- coding: utf-8 -*-
 # © 2014-2016 Therp BV <http://therp.nl>
 # 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
 
 
@@ -17,10 +17,15 @@ class CleanupPurgeLineData(models.TransientModel):
     @api.multi
     def purge(self):
         """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'))
         to_unlink.mapped('data_id').unlink()
-        return self.write({'purged': True})
+        return to_unlink.write({'purged': True})
 
 
 class CleanupPurgeWizardData(models.TransientModel):
diff --git a/database_cleanup/models/purge_menus.py b/database_cleanup/models/purge_menus.py
index 02716493365..bd6f3c8cb12 100644
--- a/database_cleanup/models/purge_menus.py
+++ b/database_cleanup/models/purge_menus.py
@@ -1,8 +1,8 @@
 # -*- coding: utf-8 -*-
 # © 2014-2016 Therp BV <http://therp.nl>
 # 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):
@@ -15,8 +15,16 @@ class CleanupPurgeLineMenu(models.TransientModel):
 
     @api.multi
     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):
diff --git a/database_cleanup/models/purge_models.py b/database_cleanup/models/purge_models.py
index 996cea61d77..41f342b8648 100644
--- a/database_cleanup/models/purge_models.py
+++ b/database_cleanup/models/purge_models.py
@@ -1,15 +1,14 @@
 # -*- coding: utf-8 -*-
 # © 2014-2016 Therp BV <http://therp.nl>
 # 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):
     _inherit = 'ir.model'
 
-    @api.multi
     def _drop_table(self):
         # Allow to skip this step during model unlink
         # The super method crashes if the model cannot be instantiated
@@ -17,25 +16,23 @@ def _drop_table(self):
             return True
         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"""
-        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):
@@ -54,9 +51,15 @@ def purge(self):
         context_flags = {
             MODULE_UNINSTALL_FLAG: True,
             'no_drop_table': 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(
                 "SELECT id, model from ir_model WHERE model = %s",
                 (line.name,))
diff --git a/database_cleanup/models/purge_modules.py b/database_cleanup/models/purge_modules.py
index 6b20b9a6fee..bdfe3fcfa49 100644
--- a/database_cleanup/models/purge_modules.py
+++ b/database_cleanup/models/purge_modules.py
@@ -1,11 +1,11 @@
 # -*- coding: utf-8 -*-
 # © 2014-2016 Therp BV <http://therp.nl>
 # 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):
@@ -41,7 +41,12 @@ def purge(self):
         Uninstall modules upon manual confirmation, then reload
         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([
             ('name', 'in', module_names)
         ])
@@ -54,7 +59,7 @@ def purge(self):
         self.env.cr.commit()  # pylint: disable=invalid-commit
         RegistryManager.new(self.env.cr.dbname, update_module=True)
         modules.unlink()
-        return self.write({'purged': True})
+        return objs.write({'purged': True})
 
 
 class CleanupPurgeWizardModule(models.TransientModel):
diff --git a/database_cleanup/models/purge_tables.py b/database_cleanup/models/purge_tables.py
index 62503f790a0..3ed41c81d12 100644
--- a/database_cleanup/models/purge_tables.py
+++ b/database_cleanup/models/purge_tables.py
@@ -1,8 +1,8 @@
 # -*- coding: utf-8 -*-
 # © 2014-2016 Therp BV <http://therp.nl>
 # 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
 
 
@@ -18,8 +18,13 @@ def purge(self):
         """
         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:
                 continue
 
@@ -84,11 +89,10 @@ def find(self):
             model_pool = self.env[model.model]
             known_tables.append(model_pool._table)
             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(
diff --git a/database_cleanup/models/purge_wizard.py b/database_cleanup/models/purge_wizard.py
index 0e1645adc76..d678645b4f6 100644
--- a/database_cleanup/models/purge_wizard.py
+++ b/database_cleanup/models/purge_wizard.py
@@ -2,8 +2,8 @@
 # © 2014-2016 Therp BV <http://therp.nl>
 # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
 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):
@@ -15,7 +15,7 @@ class CleanupPurgeLine(models.AbstractModel):
     purged = fields.Boolean('Purged', readonly=True)
     wizard_id = fields.Many2one('cleanup.purge.wizard')
 
-    logger = logging.getLogger('openerp.addons.database_cleanup')
+    logger = logging.getLogger('odoo.addons.database_cleanup')
 
     @api.multi
     def purge(self):
diff --git a/database_cleanup/tests/test_database_cleanup.py b/database_cleanup/tests/test_database_cleanup.py
index 060c9174e96..5446d2615c3 100644
--- a/database_cleanup/tests/test_database_cleanup.py
+++ b/database_cleanup/tests/test_database_cleanup.py
@@ -2,30 +2,30 @@
 # © 2016 Therp BV <http://therp.nl>
 # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
 from psycopg2 import ProgrammingError
-from openerp.modules.registry import RegistryManager
-from openerp.tools import config
-from openerp.tests.common import TransactionCase
+from odoo.modules.registry import Registry
+from odoo.tools import config
+from odoo.tests.common import TransactionCase
 
 
 class TestDatabaseCleanup(TransactionCase):
     def test_database_cleanup(self):
         # create an orphaned column
-        self.cr.execute(
+        self.env.cr.execute(
             'alter table res_users add column database_cleanup_test int')
         purge_columns = self.env['cleanup.purge.wizard.column'].create({})
         purge_columns.purge_all()
         # must be removed by the wizard
         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_users')
 
         # 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({
             'module': 'database_cleanup',
             'name': 'test_no_data_entry',
             '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.purge_all()
@@ -41,8 +41,8 @@ def test_database_cleanup(self):
         self.env.cr.execute(
             'insert into ir_attachment (name, res_model, res_id, type) values '
             "('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')
         purge_models = self.env['cleanup.purge.wizard.model'].create({})
         purge_models.purge_all()
@@ -60,7 +60,7 @@ def test_database_cleanup(self):
         # 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
         # reference to it
-        original_registry = RegistryManager.registries[self.env.cr.dbname]
+        original_registry = Registry.registries[self.env.cr.dbname]
         config.options['test_enable'] = False
         purge_modules.purge_all()
         config.options['test_enable'] = True
@@ -69,12 +69,12 @@ def test_database_cleanup(self):
             ('name', '=', 'database_cleanup_test'),
         ]))
         # reset afterwards
-        RegistryManager.registries[self.env.cr.dbname] = original_registry
+        Registry.registries[self.env.cr.dbname] = original_registry
 
         # create an orphaned table
         self.env.cr.execute('create table database_cleanup_test (test int)')
         purge_tables = self.env['cleanup.purge.wizard.table'].create({})
         purge_tables.purge_all()
         with self.assertRaises(ProgrammingError):
-            with self.registry.cursor() as cr:
+            with self.env.registry.cursor() as cr:
                 self.env.cr.execute('select * from database_cleanup_test')
diff --git a/database_cleanup/views/menu.xml b/database_cleanup/views/menu.xml
index 0796f907b07..839e509c9e9 100644
--- a/database_cleanup/views/menu.xml
+++ b/database_cleanup/views/menu.xml
@@ -1,56 +1,52 @@
 <?xml version="1.0" encoding="utf-8"?>
-<openerp>
-    <data>
-
-        <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_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_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_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>
-
-    </data>
-</openerp>
+<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_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_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_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>
+</odoo>
diff --git a/database_cleanup/views/purge_columns.xml b/database_cleanup/views/purge_columns.xml
index 1264a89072f..23eefaaef35 100644
--- a/database_cleanup/views/purge_columns.xml
+++ b/database_cleanup/views/purge_columns.xml
@@ -1,50 +1,52 @@
 <?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>
-        </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>
-        </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>
diff --git a/database_cleanup/views/purge_data.xml b/database_cleanup/views/purge_data.xml
index 3f9988be3b2..c6804a38aaa 100644
--- a/database_cleanup/views/purge_data.xml
+++ b/database_cleanup/views/purge_data.xml
@@ -1,50 +1,52 @@
 <?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>
-        </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>
-        </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>
diff --git a/database_cleanup/views/purge_menus.xml b/database_cleanup/views/purge_menus.xml
index 0bec65143b2..0757088d42f 100644
--- a/database_cleanup/views/purge_menus.xml
+++ b/database_cleanup/views/purge_menus.xml
@@ -1,47 +1,48 @@
 <?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>
diff --git a/database_cleanup/views/purge_models.xml b/database_cleanup/views/purge_models.xml
index 5b9401bebf8..b0dfa7e0d96 100644
--- a/database_cleanup/views/purge_models.xml
+++ b/database_cleanup/views/purge_models.xml
@@ -1,47 +1,48 @@
 <?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>
diff --git a/database_cleanup/views/purge_modules.xml b/database_cleanup/views/purge_modules.xml
index f5f6d2c4dc3..549563a9639 100644
--- a/database_cleanup/views/purge_modules.xml
+++ b/database_cleanup/views/purge_modules.xml
@@ -1,47 +1,48 @@
 <?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>
diff --git a/database_cleanup/views/purge_tables.xml b/database_cleanup/views/purge_tables.xml
index 9cf603cb9cc..d7d5a849fef 100644
--- a/database_cleanup/views/purge_tables.xml
+++ b/database_cleanup/views/purge_tables.xml
@@ -1,46 +1,48 @@
 <?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>
diff --git a/database_cleanup/views/purge_wizard.xml b/database_cleanup/views/purge_wizard.xml
index 40417f3a813..7f2e86cc651 100644
--- a/database_cleanup/views/purge_wizard.xml
+++ b/database_cleanup/views/purge_wizard.xml
@@ -1,41 +1,39 @@
 <?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">
-                        <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">
-                    <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>
+                <field name="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">
+                <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>
