[IMP] account_advanced_protection_features : apply changes proposed by pre-commit
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
from odoo import models, _
|
||||
from odoo import _, models
|
||||
from odoo.exceptions import UserError
|
||||
|
||||
|
||||
class AccountBankStatement(models.Model):
|
||||
_inherit = "account.bank.statement"
|
||||
|
||||
@@ -8,12 +9,16 @@ class AccountBankStatement(models.Model):
|
||||
for statement in self:
|
||||
if not statement.journal_id.allow_bank_statement_deletion:
|
||||
raise UserError(
|
||||
_("The deletion of bank statements is not allowed for the journal %s.") % statement.journal_id.display_name
|
||||
_(
|
||||
"The deletion of bank statements is "
|
||||
"not allowed for the journal %s."
|
||||
)
|
||||
% statement.journal_id.display_name
|
||||
)
|
||||
# we delete all the statement lines before deleting the statement itself
|
||||
for line in statement.line_ids:
|
||||
line.unlink()
|
||||
return super(AccountBankStatement, self).unlink()
|
||||
return super().unlink()
|
||||
|
||||
|
||||
class AccountBankStatementLine(models.Model):
|
||||
@@ -23,6 +28,10 @@ class AccountBankStatementLine(models.Model):
|
||||
for line in self:
|
||||
if not line.journal_id.allow_bank_statement_deletion:
|
||||
raise UserError(
|
||||
_("The deletion of bank statement lines is not allowed for the journal %s.") % line.journal_id.display_name
|
||||
_(
|
||||
"The deletion of bank statement lines is "
|
||||
"not allowed for the journal %s."
|
||||
)
|
||||
% line.journal_id.display_name
|
||||
)
|
||||
return super(AccountBankStatementLine, self).unlink()
|
||||
return super().unlink()
|
||||
|
||||
Reference in New Issue
Block a user