diff --git a/addons/account/models/account_bank_statement.py b/addons/account/models/account_bank_statement.py index be9f711bf3e..baa2db9b709 100644 --- a/addons/account/models/account_bank_statement.py +++ b/addons/account/models/account_bank_statement.py @@ -951,7 +951,8 @@ class AccountBankStatementLine(models.Model): aml_dict['currency_id'] = statement_currency.id def _check_invoice_state(self, invoice): - invoice._compute_amount() + if invoice.is_invoice(include_receipts=True): + invoice._compute_amount() def button_confirm_bank(self): self.statement_id.button_confirm_bank() diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py index 53fe0cf8b7b..d3d7891d7d7 100644 --- a/addons/account/models/account_move.py +++ b/addons/account/models/account_move.py @@ -1155,20 +1155,20 @@ class AccountMove(models.Model): def _inverse_amount_total(self): for move in self: - if len(move.line_ids) != 2 or move.move_type != 'entry': + if len(move.line_ids) != 2 or move.is_invoice(include_receipts=True): continue to_write = [] if move.currency_id != move.company_id.currency_id: amount_currency = abs(move.amount_total) - balance = move.currency_id._convert(amount_currency, move.currency_id, move.company_id, move.date) + balance = move.currency_id._convert(amount_currency, move.company_currency_id, move.company_id, move.date) else: balance = abs(move.amount_total) amount_currency = 0.0 for line in move.line_ids: - if abs(line.balance) != balance: + if float_compare(abs(line.balance), balance, precision_rounding=move.currency_id.rounding) != 0: to_write.append((1, line.id, { 'debit': line.balance > 0.0 and balance or 0.0, 'credit': line.balance < 0.0 and balance or 0.0,