From 2a37b95be95c16550780f248c87baba44f2c4bda Mon Sep 17 00:00:00 2001 From: Simon Gonzalez Date: Wed, 28 Jun 2023 09:17:05 +0200 Subject: [PATCH 1/2] [IMP] account_statement_import_camt54: add transfer_line to the view The parameter wasn't added to the view although it was defined in the model. --- account_statement_import_camt54/__manifest__.py | 1 + .../views/account_journal_view.xml | 14 ++++++++++++++ 2 files changed, 15 insertions(+) create mode 100644 account_statement_import_camt54/views/account_journal_view.xml diff --git a/account_statement_import_camt54/__manifest__.py b/account_statement_import_camt54/__manifest__.py index a5d82d49c..36eb84fa1 100644 --- a/account_statement_import_camt54/__manifest__.py +++ b/account_statement_import_camt54/__manifest__.py @@ -8,5 +8,6 @@ "author": "camptocamp, " "Odoo Community Association (OCA)", "license": "AGPL-3", "installable": True, + "data": ["views/account_journal_view.xml"], "depends": ["account_statement_import_camt"], } diff --git a/account_statement_import_camt54/views/account_journal_view.xml b/account_statement_import_camt54/views/account_journal_view.xml new file mode 100644 index 000000000..33423ded9 --- /dev/null +++ b/account_statement_import_camt54/views/account_journal_view.xml @@ -0,0 +1,14 @@ + + + + account.journal + + + + + + + + + + From 0301ca706d617ff1754f696fabcaeccac1e057cb Mon Sep 17 00:00:00 2001 From: Emanuel Cino Date: Thu, 7 Mar 2024 15:33:24 +0100 Subject: [PATCH 2/2] [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( {