[IMP] account_advanced_protection_features: manage allow_bank_statement_deletion in cash and bank journals
This commit is contained in:
@@ -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()
|
Reference in New Issue
Block a user