2018-01-16 06:58:15 +01:00
|
|
|
# -*- coding: utf-8 -*-
|
2018-01-16 11:34:37 +01:00
|
|
|
# Part of Odoo, Flectra. See LICENSE file for full copyright and licensing details.
|
2018-07-13 11:51:12 +02:00
|
|
|
from flectra import models, api
|
2018-01-16 11:34:37 +01:00
|
|
|
from flectra.tools.translate import _
|
|
|
|
from flectra.exceptions import UserError
|
2018-01-16 06:58:15 +01:00
|
|
|
|
|
|
|
|
|
|
|
class AccountBankStatement(models.Model):
|
|
|
|
_inherit = 'account.bank.statement'
|
|
|
|
|
2018-07-13 11:51:12 +02:00
|
|
|
@api.multi
|
2018-01-16 06:58:15 +01:00
|
|
|
def unlink(self):
|
|
|
|
for statement in self.filtered(lambda s: s.company_id._is_accounting_unalterable() and s.journal_id.journal_user):
|
|
|
|
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'
|
|
|
|
|
2018-07-13 11:51:12 +02:00
|
|
|
@api.multi
|
2018-01-16 06:58:15 +01:00
|
|
|
def unlink(self):
|
|
|
|
for line in self.filtered(lambda s: s.company_id._is_accounting_unalterable() and s.journal_id.journal_user):
|
|
|
|
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()
|