Skip to content

Commit

Permalink
[IMP] l10n_mx: Don't allow to uninstall l10n_mx_edi from settings
Browse files Browse the repository at this point in the history
closes odoo#157608

X-original-commit: ed209b8
Signed-off-by: Florian Gilbert (flg) <flg@odoo.com>
Signed-off-by: Laurent Smet (las) <las@odoo.com>
  • Loading branch information
smetl committed Mar 14, 2024
1 parent d5ccb8d commit dea48f8
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion addons/l10n_mx/models/res_config_settings.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
# -*- coding: utf-8 -*-

from odoo import fields, models
from odoo import api, fields, models


class ResConfigSettings(models.TransientModel):
_inherit = 'res.config.settings'

module_l10n_mx_edi = fields.Boolean('Mexican Electronic Invoicing')

@api.model
def get_views(self, views, options=None):
# HACK to not show the view since it uninstalls the module if unticked!
# However, we don't want to force the upgrade of the module.
# 'module_l10n_mx_edi' will be removed in master.
mx_view = self.env.ref('l10n_mx.res_config_settings_view_form', raise_if_not_found=False).sudo()
if mx_view.active:
mx_view.active = False
return super().get_views(views, options)

0 comments on commit dea48f8

Please sign in to comment.