From 6fa74e49eb6e9b60cdf43b9de4b3f5f3954a393b Mon Sep 17 00:00:00 2001 From: Carlos Lopez Date: Tue, 11 Mar 2025 10:41:42 -0500 Subject: [PATCH] [FIX] web_ir_actions_act_multi: Uninstallation Issue During uninstallation, Odoo attempts to delete columns and tables related to the ir.actions.act_multi model. However, this model shares the same table (ir_actions) with other core modules, meaning the table and its columns should not be removed. Before this commit, this issue could render the database unusable. After this commit, the database remains intact, and the module can be uninstalled without problems. --- web_ir_actions_act_multi/README.rst | 2 +- web_ir_actions_act_multi/__manifest__.py | 2 +- web_ir_actions_act_multi/i18n/es.po | 15 ++++++++ web_ir_actions_act_multi/i18n/it.po | 19 +++++++++- .../i18n/web_ir_actions_act_multi.pot | 15 ++++++++ web_ir_actions_act_multi/i18n/zh_CN.po | 15 ++++++++ web_ir_actions_act_multi/models/__init__.py | 1 + web_ir_actions_act_multi/models/ir_model.py | 37 +++++++++++++++++++ .../static/description/index.html | 16 ++++---- 9 files changed, 111 insertions(+), 11 deletions(-) create mode 100644 web_ir_actions_act_multi/models/ir_model.py diff --git a/web_ir_actions_act_multi/README.rst b/web_ir_actions_act_multi/README.rst index 919589df6..28bb5b506 100644 --- a/web_ir_actions_act_multi/README.rst +++ b/web_ir_actions_act_multi/README.rst @@ -7,7 +7,7 @@ Web Actions Multi !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !! source digest: sha256:6e9f7ee51281d6578d60492d6f8973b4e90a3802e50aa5c3f1e6e0fe017c9327 + !! source digest: sha256:2748259f3e8355dce1c410234958cf54f9b9c3041d67d18d2f1bf126649da427 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png diff --git a/web_ir_actions_act_multi/__manifest__.py b/web_ir_actions_act_multi/__manifest__.py index 581644a8d..056fdeb3b 100644 --- a/web_ir_actions_act_multi/__manifest__.py +++ b/web_ir_actions_act_multi/__manifest__.py @@ -8,7 +8,7 @@ "name": "Web Actions Multi", "summary": "Enables triggering of more than one action on ActionManager", "category": "Web", - "version": "16.0.1.0.0", + "version": "16.0.1.0.1", "license": "LGPL-3", "author": "Modoolar, " "CorporateHub, " "Odoo Community Association (OCA)", "website": "https://github.com/OCA/web", diff --git a/web_ir_actions_act_multi/i18n/es.po b/web_ir_actions_act_multi/i18n/es.po index da59d20f1..c5635763d 100644 --- a/web_ir_actions_act_multi/i18n/es.po +++ b/web_ir_actions_act_multi/i18n/es.po @@ -70,6 +70,11 @@ msgstr "Mostrar Nombre" msgid "External ID" msgstr "ID Externa" +#. module: web_ir_actions_act_multi +#: model:ir.model,name:web_ir_actions_act_multi.model_ir_model_fields +msgid "Fields" +msgstr "" + #. module: web_ir_actions_act_multi #: model:ir.model.fields,field_description:web_ir_actions_act_multi.field_ir_actions_act_multi__id msgid "ID" @@ -90,6 +95,16 @@ msgstr "Última actualización por" msgid "Last Updated on" msgstr "Última Actualización el" +#. module: web_ir_actions_act_multi +#: model:ir.model,name:web_ir_actions_act_multi.model_ir_model_data +msgid "Model Data" +msgstr "" + +#. module: web_ir_actions_act_multi +#: model:ir.model,name:web_ir_actions_act_multi.model_ir_model +msgid "Models" +msgstr "" + #. module: web_ir_actions_act_multi #: model:ir.model.fields,help:web_ir_actions_act_multi.field_ir_actions_act_multi__help msgid "" diff --git a/web_ir_actions_act_multi/i18n/it.po b/web_ir_actions_act_multi/i18n/it.po index 839d58829..e33f6062f 100644 --- a/web_ir_actions_act_multi/i18n/it.po +++ b/web_ir_actions_act_multi/i18n/it.po @@ -71,6 +71,11 @@ msgstr "Nome visualizzato" msgid "External ID" msgstr "ID esterno" +#. module: web_ir_actions_act_multi +#: model:ir.model,name:web_ir_actions_act_multi.model_ir_model_fields +msgid "Fields" +msgstr "" + #. module: web_ir_actions_act_multi #: model:ir.model.fields,field_description:web_ir_actions_act_multi.field_ir_actions_act_multi__id msgid "ID" @@ -91,11 +96,21 @@ msgstr "Ultimo aggiornamento di" msgid "Last Updated on" msgstr "Ultimo aggiornamento il" +#. module: web_ir_actions_act_multi +#: model:ir.model,name:web_ir_actions_act_multi.model_ir_model_data +msgid "Model Data" +msgstr "" + +#. module: web_ir_actions_act_multi +#: model:ir.model,name:web_ir_actions_act_multi.model_ir_model +msgid "Models" +msgstr "" + #. module: web_ir_actions_act_multi #: model:ir.model.fields,help:web_ir_actions_act_multi.field_ir_actions_act_multi__help msgid "" -"Optional help text for the users with a description of the target view, such" -" as its usage and purpose." +"Optional help text for the users with a description of the target view, such " +"as its usage and purpose." msgstr "" "Testo di aiuto opzionale per l'utente con una descrizione della vista " "obiettivo, come il suo utilizzo e obiettivo." diff --git a/web_ir_actions_act_multi/i18n/web_ir_actions_act_multi.pot b/web_ir_actions_act_multi/i18n/web_ir_actions_act_multi.pot index e4d3d8e7c..07a467ccc 100644 --- a/web_ir_actions_act_multi/i18n/web_ir_actions_act_multi.pot +++ b/web_ir_actions_act_multi/i18n/web_ir_actions_act_multi.pot @@ -68,6 +68,11 @@ msgstr "" msgid "External ID" msgstr "" +#. module: web_ir_actions_act_multi +#: model:ir.model,name:web_ir_actions_act_multi.model_ir_model_fields +msgid "Fields" +msgstr "" + #. module: web_ir_actions_act_multi #: model:ir.model.fields,field_description:web_ir_actions_act_multi.field_ir_actions_act_multi__id msgid "ID" @@ -88,6 +93,16 @@ msgstr "" msgid "Last Updated on" msgstr "" +#. module: web_ir_actions_act_multi +#: model:ir.model,name:web_ir_actions_act_multi.model_ir_model_data +msgid "Model Data" +msgstr "" + +#. module: web_ir_actions_act_multi +#: model:ir.model,name:web_ir_actions_act_multi.model_ir_model +msgid "Models" +msgstr "" + #. module: web_ir_actions_act_multi #: model:ir.model.fields,help:web_ir_actions_act_multi.field_ir_actions_act_multi__help msgid "" diff --git a/web_ir_actions_act_multi/i18n/zh_CN.po b/web_ir_actions_act_multi/i18n/zh_CN.po index c39c995e8..5432c6886 100644 --- a/web_ir_actions_act_multi/i18n/zh_CN.po +++ b/web_ir_actions_act_multi/i18n/zh_CN.po @@ -68,6 +68,11 @@ msgstr "" msgid "External ID" msgstr "" +#. module: web_ir_actions_act_multi +#: model:ir.model,name:web_ir_actions_act_multi.model_ir_model_fields +msgid "Fields" +msgstr "" + #. module: web_ir_actions_act_multi #: model:ir.model.fields,field_description:web_ir_actions_act_multi.field_ir_actions_act_multi__id msgid "ID" @@ -88,6 +93,16 @@ msgstr "" msgid "Last Updated on" msgstr "" +#. module: web_ir_actions_act_multi +#: model:ir.model,name:web_ir_actions_act_multi.model_ir_model_data +msgid "Model Data" +msgstr "" + +#. module: web_ir_actions_act_multi +#: model:ir.model,name:web_ir_actions_act_multi.model_ir_model +msgid "Models" +msgstr "" + #. module: web_ir_actions_act_multi #: model:ir.model.fields,help:web_ir_actions_act_multi.field_ir_actions_act_multi__help msgid "" diff --git a/web_ir_actions_act_multi/models/__init__.py b/web_ir_actions_act_multi/models/__init__.py index 16285e5e1..1becfc074 100644 --- a/web_ir_actions_act_multi/models/__init__.py +++ b/web_ir_actions_act_multi/models/__init__.py @@ -1 +1,2 @@ from . import ir_actions +from . import ir_model diff --git a/web_ir_actions_act_multi/models/ir_model.py b/web_ir_actions_act_multi/models/ir_model.py new file mode 100644 index 000000000..3da5fbc2e --- /dev/null +++ b/web_ir_actions_act_multi/models/ir_model.py @@ -0,0 +1,37 @@ +from odoo import api, models + + +class IrModelData(models.Model): + _inherit = "ir.model.data" + + @api.model + def _module_data_uninstall(self, modules_to_remove): + # Set a flag to prevent the deletion of tables and columns + # related to ir.actions.act_multi. + if "web_ir_actions_act_multi" in modules_to_remove: + self = self.with_context(uninstall_web_ir_actions_act_multi=True) + return super(IrModelData, self)._module_data_uninstall(modules_to_remove) + + +class IrModel(models.Model): + _inherit = "ir.model" + + def _drop_table(self): + # Prevent the deletion of the table. + # The model is ir.actions.act_multi, but the actual table is ir_actions. + # This table is a core component and should not be removed. + if self.env.context.get("uninstall_web_ir_actions_act_multi"): + self -= self.filtered(lambda model: model.model == "ir.actions.act_multi") + return super()._drop_table() + + +class IrModelFields(models.Model): + _inherit = "ir.model.fields" + + def _drop_column(self): + # Prevent the deletion of columns in the ir_actions table. + # The model is ir.actions.act_multi, but the actual table is ir_actions. + # Since this table is a core component, its columns should not be deleted. + if self.env.context.get("uninstall_web_ir_actions_act_multi"): + self -= self.filtered(lambda field: field.model == "ir.actions.act_multi") + return super()._drop_column() diff --git a/web_ir_actions_act_multi/static/description/index.html b/web_ir_actions_act_multi/static/description/index.html index 5d80e0793..814d795ee 100644 --- a/web_ir_actions_act_multi/static/description/index.html +++ b/web_ir_actions_act_multi/static/description/index.html @@ -1,4 +1,3 @@ - @@ -9,10 +8,11 @@ /* :Author: David Goodger (goodger@python.org) -:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $ +:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $ :Copyright: This stylesheet has been placed in the public domain. Default cascading style sheet for the HTML output of Docutils. +Despite the name, some widely supported CSS2 features are used. See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to customize this style sheet. @@ -275,7 +275,7 @@ pre.literal-block, pre.doctest-block, pre.math, pre.code { margin-left: 2em ; margin-right: 2em } -pre.code .ln { color: grey; } /* line numbers */ +pre.code .ln { color: gray; } /* line numbers */ pre.code, code { background-color: #eeeeee } pre.code .comment, code .comment { color: #5C6576 } pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold } @@ -301,7 +301,7 @@ span.option { span.pre { white-space: pre } -span.problematic { +span.problematic, pre.problematic { color: red } span.section-subtitle { @@ -367,7 +367,7 @@ ul.auto-toc { !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -!! source digest: sha256:6e9f7ee51281d6578d60492d6f8973b4e90a3802e50aa5c3f1e6e0fe017c9327 +!! source digest: sha256:2748259f3e8355dce1c410234958cf54f9b9c3041d67d18d2f1bf126649da427 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->

Beta License: LGPL-3 OCA/web Translate me on Weblate Try me on Runboat

This module provides a way to trigger more than one action on ActionManager

@@ -388,7 +388,7 @@ ul.auto-toc {

Usage

To use this functionality you need to return following action with list of actions to execute:

-def foo(self):
+def foo(self):
    self.ensure_one()
    return {
       'type': 'ir.actions.act_multi',
@@ -432,7 +432,9 @@ If you spotted it first, help us to smash it by providing a detailed and welcome
 

Maintainers

This module is maintained by the OCA.

-Odoo Community Association + +Odoo Community Association +

OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.