Initial commit: Odoo 18.0-20251222 extra-addons
This commit is contained in:
2
web_ir_actions_act_multi/models/__init__.py
Executable file
2
web_ir_actions_act_multi/models/__init__.py
Executable file
@@ -0,0 +1,2 @@
|
||||
from . import ir_actions
|
||||
from . import ir_model
|
||||
15
web_ir_actions_act_multi/models/ir_actions.py
Executable file
15
web_ir_actions_act_multi/models/ir_actions.py
Executable file
@@ -0,0 +1,15 @@
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo import fields, models
|
||||
|
||||
|
||||
class IrActionsActMulti(models.Model):
|
||||
_name = "ir.actions.act_multi"
|
||||
_description = "Action Mulit"
|
||||
_inherit = "ir.actions.actions"
|
||||
_table = "ir_actions"
|
||||
|
||||
type = fields.Char(default="ir.actions.act_multi")
|
||||
|
||||
def _get_readable_fields(self):
|
||||
return super()._get_readable_fields() | {"actions"}
|
||||
37
web_ir_actions_act_multi/models/ir_model.py
Executable file
37
web_ir_actions_act_multi/models/ir_model.py
Executable file
@@ -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()._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()
|
||||
Reference in New Issue
Block a user