2
0
account-financial-tools/account_journal_restrict_mode/hooks.py

14 lines
446 B
Python
Raw Permalink Normal View History

2023-10-02 16:46:22 +02:00
# Copyright 2023 ForgeFlow S.L.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import SUPERUSER_ID, api
def post_init_hook(cr, registry):
"""Enable restrict mode on all journals"""
env = api.Environment(cr, SUPERUSER_ID, {})
journals_to_update = env["account.journal"].search(
[("restrict_mode_hash_table", "=", False)]
)
journals_to_update.write({"restrict_mode_hash_table": True})