Skip to content

Commit acb23b6

Browse files
committed
Merge PR #3120 into 15.0
Signed-off-by pedrobaeza
2 parents 38c19aa + cedc976 commit acb23b6

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
from . import ir_actions
2+
from . import ir_model
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
from odoo import api, models
2+
3+
4+
class IrModelData(models.Model):
5+
_inherit = "ir.model.data"
6+
7+
@api.model
8+
def _module_data_uninstall(self, modules_to_remove):
9+
# Set a flag to prevent the deletion of tables and columns
10+
# related to ir.actions.act_multi.
11+
if "web_ir_actions_act_multi" in modules_to_remove:
12+
self = self.with_context(uninstall_web_ir_actions_act_multi=True)
13+
return super(IrModelData, self)._module_data_uninstall(modules_to_remove)
14+
15+
16+
class IrModel(models.Model):
17+
_inherit = "ir.model"
18+
19+
def _drop_table(self):
20+
# Prevent the deletion of the table.
21+
# The model is ir.actions.act_multi, but the actual table is ir_actions.
22+
# This table is a core component and should not be removed.
23+
if self.env.context.get("uninstall_web_ir_actions_act_multi"):
24+
self -= self.filtered(lambda model: model.model == "ir.actions.act_multi")
25+
return super()._drop_table()
26+
27+
28+
class IrModelFields(models.Model):
29+
_inherit = "ir.model.fields"
30+
31+
def _drop_column(self):
32+
# Prevent the deletion of columns in the ir_actions table.
33+
# The model is ir.actions.act_multi, but the actual table is ir_actions.
34+
# Since this table is a core component, its columns should not be deleted.
35+
if self.env.context.get("uninstall_web_ir_actions_act_multi"):
36+
self -= self.filtered(lambda field: field.model == "ir.actions.act_multi")
37+
return super()._drop_column()

0 commit comments

Comments
 (0)