From 0301ca706d617ff1754f696fabcaeccac1e057cb Mon Sep 17 00:00:00 2001 From: Emanuel Cino Date: Thu, 7 Mar 2024 15:33:24 +0100 Subject: [PATCH] [IMP] account_statement_import_camt54: transfer_line feature - Use currency.iz_zero() instead of direct comparison - Add information about camt54 usage in the help of the field --- account_statement_import_camt54/models/account_journal.py | 3 ++- .../models/account_statement_import.py | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/account_statement_import_camt54/models/account_journal.py b/account_statement_import_camt54/models/account_journal.py index 752187a69..c655f3137 100644 --- a/account_statement_import_camt54/models/account_journal.py +++ b/account_statement_import_camt54/models/account_journal.py @@ -10,5 +10,6 @@ class AccountBankStatementImport(models.Model): transfer_line = fields.Boolean( string="Add balance Line", - help="Generate balance line on total of bank statement import", + help="For camt54 files, generate balance line on total of bank statement " + "import", ) diff --git a/account_statement_import_camt54/models/account_statement_import.py b/account_statement_import_camt54/models/account_statement_import.py index 40b6dbf59..80cb83b92 100644 --- a/account_statement_import_camt54/models/account_statement_import.py +++ b/account_statement_import_camt54/models/account_statement_import.py @@ -20,8 +20,9 @@ def _create_bank_statements(self, stmts_vals, result): statements = self.env["account.bank.statement"].browse(result["statement_ids"]) for statement in statements: amount = sum(statement.line_ids.mapped("amount")) - if statement.journal_id.transfer_line: - if amount != 0: + journal = statement.journal_id + if journal.transfer_line: + if not journal.currency_id.is_zero(amount): amount = -amount statement.line_ids.create( {