diff --git a/fiscal_company_base/__manifest__.py b/fiscal_company_base/__manifest__.py index 36ee0d6..bfbed8b 100644 --- a/fiscal_company_base/__manifest__.py +++ b/fiscal_company_base/__manifest__.py @@ -5,7 +5,7 @@ { "name": "CAE - Base", - "version": "16.0.1.1.1", + "version": "16.0.2.0.0", "category": "CAE", "summary": "Manage CAE (Cooperatives of Activities and Employment)", "author": "GRAP", @@ -18,7 +18,7 @@ "mail", ], "data": [ - # "security/ir_rule.xml", + "security/ir_rule.xml", "views/view_res_company.xml", ], "demo": [ diff --git a/fiscal_company_base/hooks.py b/fiscal_company_base/hooks.py new file mode 100644 index 0000000..0bfde4b --- /dev/null +++ b/fiscal_company_base/hooks.py @@ -0,0 +1,25 @@ +import logging + +from odoo import SUPERUSER_ID, api + +_logger = logging.getLogger(__name__) + + +_CORE_RULES = [ + "base.res_company_rule_employee", # res.company +] + + +def post_init_hook(cr, registry): + _toggle_standard_rules(cr, False) + + +def uninstall_hook(cr, registry): + _toggle_standard_rules(cr, True) + + +def _toggle_standard_rules(cr, enabled): + env = api.Environment(cr, SUPERUSER_ID, {}) + for xml_id in _CORE_RULES: + rule = env.ref(xml_id) + rule.active = enabled diff --git a/fiscal_company_base/migrations/16.0.2.0.0/post-migration.py b/fiscal_company_base/migrations/16.0.2.0.0/post-migration.py new file mode 100644 index 0000000..0ff278d --- /dev/null +++ b/fiscal_company_base/migrations/16.0.2.0.0/post-migration.py @@ -0,0 +1,11 @@ +# Copyright (C) 2024-Today: GRAP (http://www.grap.coop) +# @author: Sylvain LE GAL (https://twitter.com/legalsylvain) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + + +# pylint: disable=W8150 +from odoo.addons.fiscal_company_base import hooks + + +def migrate(cr, version): + hooks._toggle_standard_rules(cr, False) diff --git a/fiscal_company_base/security/ir_rule.xml b/fiscal_company_base/security/ir_rule.xml index a8fa53b..f8b5380 100644 --- a/fiscal_company_base/security/ir_rule.xml +++ b/fiscal_company_base/security/ir_rule.xml @@ -8,11 +8,24 @@ Copyright (C) 2013-Today GRAP (http://www.grap.coop) + + + + + res.company (fiscal_company_base) + + + + + [(1,'=',1)] + + + - +