Initial commit: Odoo 18.0-20251222 extra-addons
Some checks failed
pre-commit / pre-commit (push) Has been cancelled
tests / Detect unreleased dependencies (push) Has been cancelled
tests / test with OCB (push) Has been cancelled
tests / test with Odoo (push) Has been cancelled

This commit is contained in:
tocmo0nlord
2026-03-13 20:43:25 +00:00
parent 36e847a7df
commit adbe430761
9472 changed files with 1265727 additions and 0 deletions

View File

@@ -0,0 +1,3 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from . import account_journal

View File

@@ -0,0 +1,45 @@
# Copyright 2023 ForgeFlow S.L.
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo import api, fields, models
from odoo.exceptions import UserError
from odoo.tools import config
class AccountJournal(models.Model):
_inherit = "account.journal"
restrict_mode_hash_table = fields.Boolean(
compute="_compute_restrict_mode_hash_table", store=True, readonly=True
)
@api.constrains("restrict_mode_hash_table", "type")
def _check_journal_restrict_mode(self):
test_condition = not config["test_enable"] or (
config["test_enable"]
and self.env.context.get("test_account_journal_restrict_mode")
)
if not test_condition:
return
for rec in self:
if not rec.restrict_mode_hash_table and rec.type in [
"sale",
"purchase",
"general",
]:
raise UserError(
self.env._("Journal %s must have Lock Posted Entries enabled.")
% rec.name
)
@api.depends("type")
def _compute_restrict_mode_hash_table(self):
test_condition = not config["test_enable"] or (
config["test_enable"]
and self.env.context.get("test_account_journal_restrict_mode")
)
for rec in self:
if not test_condition:
rec.restrict_mode_hash_table = False
continue
rec.restrict_mode_hash_table = rec.type in ["sale", "purchase", "general"]