summaryrefslogtreecommitdiff
path: root/addons/account/models
diff options
context:
space:
mode:
authorJohn (jol) <jol@odoo.com>2021-01-29 11:30:49 +0000
committerJohn (jol) <jol@odoo.com>2021-02-01 13:57:31 +0000
commitee4f7df8d34593bdde3fc6f9bd062f6dad238fcb (patch)
treece065e46292ceb37c20010960aaeb4a7b4cdf307 /addons/account/models
parent036992d2d3ff132666085ff30d832f0f65d7afd4 (diff)
[FIX] account: remove constraint on bank statement line amount = 0
A former constraint made it impossible to import bank statements with lines = 0. The task #2403369 removed that constraint. But the user could no longer reconcile Bank Statement Lines = 0. Drawbacks : - The user is then blocked when setting a lock date. - The bank statement remains endlessly in Status Processing A previous fix made a bank statement line = 0 immediately reconciled. Closes task #2449127. closes odoo/odoo#65269 Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
Diffstat (limited to 'addons/account/models')
-rw-r--r--addons/account/models/account_bank_statement.py6
1 files changed, 0 insertions, 6 deletions
diff --git a/addons/account/models/account_bank_statement.py b/addons/account/models/account_bank_statement.py
index 837bd1a714d..01753288dee 100644
--- a/addons/account/models/account_bank_statement.py
+++ b/addons/account/models/account_bank_statement.py
@@ -809,18 +809,12 @@ class AccountBankStatementLine(models.Model):
@api.constrains('amount', 'amount_currency', 'currency_id', 'foreign_currency_id', 'journal_id')
def _check_amounts_currencies(self):
''' Ensure the consistency the specified amounts and the currencies. '''
- if self._context.get('skip_check_amounts_currencies'):
- return
for st_line in self:
if st_line.journal_id != st_line.statement_id.journal_id:
raise ValidationError(_('The journal of a statement line must always be the same as the bank statement one.'))
- if st_line.currency_id.is_zero(st_line.amount):
- raise ValidationError(_("The amount of a statement line can't be equal to zero."))
if st_line.foreign_currency_id == st_line.currency_id:
raise ValidationError(_("The foreign currency must be different than the journal one: %s", st_line.currency_id.name))
- if st_line.foreign_currency_id and st_line.foreign_currency_id.is_zero(st_line.amount_currency):
- raise ValidationError(_("The amount in foreign currency must be set if the amount is not equal to zero."))
if not st_line.foreign_currency_id and st_line.amount_currency:
raise ValidationError(_("You can't provide an amount in foreign currency without specifying a foreign currency."))