[IMP] account_advanced_protection_features: manage allow_bank_statement_deletion in cash and bank journals

This commit is contained in:
2025-08-22 10:04:49 +02:00
parent a0ab4f96bd
commit 0785c49c96
4 changed files with 19 additions and 0 deletions

View File

@@ -0,0 +1,13 @@
from odoo import models, _
from odoo.exceptions import UserError
class AccountBankStatement(models.Model):
_inherit = "account.bank.statement"
def unlink(self):
for statement in self:
if not statement.journal_id.allow_bank_statement_deletion:
raise UserError(
_(f"The deletion of bank statements is not allowed for the journal {statement.journal_id.display_name}.")
)
return super(AccountBankStatement, self).unlink()