summaryrefslogtreecommitdiff
path: root/addons/l10n_fr_pos_cert/models/account_bank_statement.py
diff options
context:
space:
mode:
authorstephanchrst <stephanchrst@gmail.com>2022-05-10 21:51:50 +0700
committerstephanchrst <stephanchrst@gmail.com>2022-05-10 21:51:50 +0700
commit3751379f1e9a4c215fb6eb898b4ccc67659b9ace (patch)
treea44932296ef4a9b71d5f010906253d8c53727726 /addons/l10n_fr_pos_cert/models/account_bank_statement.py
parent0a15094050bfde69a06d6eff798e9a8ddf2b8c21 (diff)
initial commit 2
Diffstat (limited to 'addons/l10n_fr_pos_cert/models/account_bank_statement.py')
-rw-r--r--addons/l10n_fr_pos_cert/models/account_bank_statement.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/addons/l10n_fr_pos_cert/models/account_bank_statement.py b/addons/l10n_fr_pos_cert/models/account_bank_statement.py
new file mode 100644
index 00000000..f8ace6d2
--- /dev/null
+++ b/addons/l10n_fr_pos_cert/models/account_bank_statement.py
@@ -0,0 +1,23 @@
+# -*- coding: utf-8 -*-
+# Part of Odoo. See LICENSE file for full copyright and licensing details.
+from odoo import models, api
+from odoo.tools.translate import _
+from odoo.exceptions import UserError
+
+
+class AccountBankStatement(models.Model):
+ _inherit = 'account.bank.statement'
+
+ def unlink(self):
+ for statement in self.filtered(lambda s: s.company_id._is_accounting_unalterable() and s.journal_id.pos_payment_method_ids):
+ raise UserError(_('You cannot modify anything on a bank statement (name: %s) that was created by point of sale operations.') % (statement.name,))
+ return super(AccountBankStatement, self).unlink()
+
+
+class AccountBankStatementLine(models.Model):
+ _inherit = 'account.bank.statement.line'
+
+ def unlink(self):
+ for line in self.filtered(lambda s: s.company_id._is_accounting_unalterable() and s.journal_id.pos_payment_method_ids):
+ raise UserError(_('You cannot modify anything on a bank statement line (name: %s) that was created by point of sale operations.') % (line.name,))
+ return super(AccountBankStatementLine, self).unlink()