diff --git a/account_statement_import_file/README.rst b/account_statement_import_file/README.rst index b9df55791..a25292c28 100644 --- a/account_statement_import_file/README.rst +++ b/account_statement_import_file/README.rst @@ -17,13 +17,13 @@ Import Statement Files :target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html :alt: License: LGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fbank--statement--import-lightgray.png?logo=github - :target: https://github.com/OCA/bank-statement-import/tree/17.0/account_statement_import_file + :target: https://github.com/OCA/bank-statement-import/tree/18.0/account_statement_import_file :alt: OCA/bank-statement-import .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/bank-statement-import-17-0/bank-statement-import-17-0-account_statement_import_file + :target: https://translation.odoo-community.org/projects/bank-statement-import-18-0/bank-statement-import-18-0-account_statement_import_file :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png - :target: https://runboat.odoo-community.org/builds?repo=OCA/bank-statement-import&target_branch=17.0 + :target: https://runboat.odoo-community.org/builds?repo=OCA/bank-statement-import&target_branch=18.0 :alt: Try me on Runboat |badge1| |badge2| |badge3| |badge4| |badge5| @@ -81,7 +81,7 @@ Bug Tracker Bugs are tracked on `GitHub Issues `_. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us to smash it by providing a detailed and welcomed -`feedback `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -98,10 +98,23 @@ Contributors ------------ - Odoo S.A. + - Alexis de Lattre + - Tecnativa - Pedro M. Baeza + - Sygel - Manuel Regidor +- Trobz + + - Do Anh Duy + +Other credits +------------- + +The migration of this module from 17.0 to 18.0 was financially supported +by Camptocamp. + Maintainers ----------- @@ -123,6 +136,6 @@ Current `maintainer `__: |maintainer-alexis-via| -This module is part of the `OCA/bank-statement-import `_ project on GitHub. +This module is part of the `OCA/bank-statement-import `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/account_statement_import_file/__manifest__.py b/account_statement_import_file/__manifest__.py index c0e5bc2ae..f0edf9f25 100644 --- a/account_statement_import_file/__manifest__.py +++ b/account_statement_import_file/__manifest__.py @@ -6,7 +6,7 @@ { "name": "Import Statement Files", "category": "Accounting", - "version": "17.0.1.0.0", + "version": "18.0.1.0.0", "license": "LGPL-3", "depends": ["account_statement_import_base"], "author": "Odoo SA, Akretion, Odoo Community Association (OCA)", diff --git a/account_statement_import_file/models/account_journal.py b/account_statement_import_file/models/account_journal.py index 44ef6a299..fb0a069b7 100644 --- a/account_statement_import_file/models/account_journal.py +++ b/account_statement_import_file/models/account_journal.py @@ -3,7 +3,7 @@ # @author: Alexis de Lattre # Licence LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl-3.0). -from odoo import _, api, models +from odoo import api, models class AccountJournal(models.Model): @@ -28,7 +28,7 @@ def __get_bank_statements_available_sources(self): formats_list.sort() import_formats_str = ", ".join(formats_list) rslt.insert( - 0, ("file_import_oca", _("Import") + "(" + import_formats_str + ")") + 0, ("file_import_oca", self.env._(f"Import ({import_formats_str})")) ) return rslt diff --git a/account_statement_import_file/readme/CONTRIBUTORS.md b/account_statement_import_file/readme/CONTRIBUTORS.md index 44935e2ac..6285ab2c7 100644 --- a/account_statement_import_file/readme/CONTRIBUTORS.md +++ b/account_statement_import_file/readme/CONTRIBUTORS.md @@ -2,3 +2,6 @@ - Alexis de Lattre \<\> - Tecnativa - Pedro M. Baeza - Sygel - Manuel Regidor + +- Trobz \<\> + - Do Anh Duy \<\> diff --git a/account_statement_import_file/readme/CREDITS.md b/account_statement_import_file/readme/CREDITS.md new file mode 100644 index 000000000..83b3ec91f --- /dev/null +++ b/account_statement_import_file/readme/CREDITS.md @@ -0,0 +1 @@ +The migration of this module from 17.0 to 18.0 was financially supported by Camptocamp. diff --git a/account_statement_import_file/static/description/index.html b/account_statement_import_file/static/description/index.html index ec2f814c0..a207230c6 100644 --- a/account_statement_import_file/static/description/index.html +++ b/account_statement_import_file/static/description/index.html @@ -8,10 +8,11 @@ /* :Author: David Goodger (goodger@python.org) -:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $ +:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $ :Copyright: This stylesheet has been placed in the public domain. Default cascading style sheet for the HTML output of Docutils. +Despite the name, some widely supported CSS2 features are used. See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to customize this style sheet. @@ -274,7 +275,7 @@ margin-left: 2em ; margin-right: 2em } -pre.code .ln { color: grey; } /* line numbers */ +pre.code .ln { color: gray; } /* line numbers */ pre.code, code { background-color: #eeeeee } pre.code .comment, code .comment { color: #5C6576 } pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold } @@ -300,7 +301,7 @@ span.pre { white-space: pre } -span.problematic { +span.problematic, pre.problematic { color: red } span.section-subtitle { @@ -368,7 +369,7 @@

Import Statement Files

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! source digest: sha256:617132b3a1943c54ccad25dfc759a97108915b2d1f9d78c4c4ed5682358fdc4d !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

Mature License: LGPL-3 OCA/bank-statement-import Translate me on Weblate Try me on Runboat

+

Mature License: LGPL-3 OCA/bank-statement-import Translate me on Weblate Try me on Runboat

This module is the successor of the module account_bank_statement_import that was part of Odoo Community until Odoo v13 and was moved to Odoo Enterprise for Odoo v14 (cf this @@ -398,7 +399,8 @@

Import Statement Files

  • Credits
  • @@ -424,7 +426,7 @@

    Bug Tracker

    Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us to smash it by providing a detailed and welcomed -feedback.

    +feedback.

    Do not contact contributors directly about support or help with technical issues.

    @@ -443,18 +445,29 @@

    Contributors

  • Alexis de Lattre <alexis.delattre@akretion.com>
  • Tecnativa - Pedro M. Baeza
  • Sygel - Manuel Regidor
  • +
  • Trobz <https://www.trobz.com/> +
  • + +
    +
    +

    Other credits

    +

    The migration of this module from 17.0 to 18.0 was financially supported +by Camptocamp.

    -

    Maintainers

    +

    Maintainers

    This module is maintained by the OCA.

    -Odoo Community Association + +Odoo Community Association +

    OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.

    Current maintainer:

    alexis-via

    -

    This module is part of the OCA/bank-statement-import project on GitHub.

    +

    This module is part of the OCA/bank-statement-import project on GitHub.

    You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

    diff --git a/account_statement_import_file/tests/test_file.txt b/account_statement_import_file/tests/samples/test_statement_import.txt similarity index 100% rename from account_statement_import_file/tests/test_file.txt rename to account_statement_import_file/tests/samples/test_statement_import.txt diff --git a/account_statement_import_file/tests/test_account_statement_import_file.py b/account_statement_import_file/tests/test_account_statement_import_file.py index b5ccd0ae4..b9c69cbec 100644 --- a/account_statement_import_file/tests/test_account_statement_import_file.py +++ b/account_statement_import_file/tests/test_account_statement_import_file.py @@ -12,9 +12,7 @@ class TestAccountStatementImportFile(common.TransactionCase): @classmethod def setUpClass(cls): super().setUpClass() - cls.eur_currency = cls.env["res.currency"].search( - [("name", "=", "EUR"), ("active", "=", False)], limit=1 - ) + cls.eur_currency = cls.env.ref("base.EUR") cls.eur_currency.write({"active": True}) cls.bank_account = cls.env["res.partner.bank"].create( {"acc_number": "1111111111", "partner_id": cls.env.company.partner_id.id} @@ -38,7 +36,9 @@ def setUpClass(cls): "bank_account_id": cls.bank_account.id, } ) - f_path = file_path("account_statement_import_file/tests/test_file.txt") + f_path = file_path( + "account_statement_import_file/tests/samples/test_statement_import.txt" + ) file = base64.b64encode(open(f_path, "rb").read()) cls.import_wizard = ( cls.env["account.statement.import"] diff --git a/account_statement_import_file/wizard/account_statement_import.py b/account_statement_import_file/wizard/account_statement_import.py index 56ca28a0e..faed74006 100644 --- a/account_statement_import_file/wizard/account_statement_import.py +++ b/account_statement_import_file/wizard/account_statement_import.py @@ -4,7 +4,7 @@ import base64 import logging -from odoo import _, api, fields, models +from odoo import api, fields, models from odoo.exceptions import UserError from odoo.addons.base.models.res_bank import sanitize_account_number @@ -34,7 +34,7 @@ def _import_file(self): logger.debug("result=%s", result) if not result["statement_ids"]: raise UserError( - _( + self.env._( "You have already imported this file, or this file " "only contains already imported transactions." ) @@ -92,32 +92,36 @@ def import_single_file(self, file_data, result): self.statement_filename, len(parsing_data), ) - i = 0 - for single_statement_data in parsing_data: - i += 1 + for idx, single_statement_data in enumerate(parsing_data, start=1): logger.debug( - "account %d: single_statement_data=%s", i, single_statement_data + "account %d: single_statement_data=%s", idx, single_statement_data ) self.import_single_statement(single_statement_data, result) def import_single_statement(self, single_statement_data, result): if not isinstance(single_statement_data, tuple): raise UserError( - _("The parsing of the statement file returned an invalid result.") + self.env._( + "The parsing of the statement file returned an invalid result." + ) ) currency_code, account_number, stmts_vals = single_statement_data # Check raw data if not self._check_parsed_data(stmts_vals): return False if not currency_code: - raise UserError(_("Missing currency code in the bank statement file.")) + raise UserError( + self.env._("Missing currency code in the bank statement file.") + ) # account_number can be None (example : QIF) currency = self._match_currency(currency_code) journal = self._match_journal(account_number, currency) if not journal.default_account_id: raise UserError( - _("The Bank Accounting Account is not set on the journal '%s'.") - % journal.display_name + self.env._( + "The Bank Accounting Account is not set on the journal '%s'.", + journal.display_name, + ) ) # Prepare statement data to be used for bank statements creation stmts_vals = self._complete_stmts_vals(stmts_vals, journal, account_number) @@ -161,7 +165,7 @@ def _parse_file(self, data_file): a list of triplets. """ raise UserError( - _( + self.env._( "This bank statement file format is not supported.\n" "Did you install the Odoo module to support this format?" ) @@ -193,11 +197,11 @@ def _match_currency(self, currency_code): ) if not currency: raise UserError( - _( + self.env._( "The bank statement file uses currency '%s' " - "but there is no such currency in Odoo." + "but there is no such currency in Odoo.", + currency_code, ) - % currency_code ) return currency @@ -208,7 +212,7 @@ def _match_journal(self, account_number, currency): if not account_number: # exemple : QIF if not self.env.context.get("journal_id"): raise UserError( - _( + self.env._( "The format of this bank statement file doesn't " "contain the bank account number, so you must " "start the wizard from the right bank journal " @@ -234,7 +238,7 @@ def _match_journal(self, account_number, currency): if journal and ctx_journal_id and journal.id != ctx_journal_id: ctx_journal = journal_obj.browse(ctx_journal_id) raise UserError( - _( + self.env._( "The journal found for the file (%(journal_match)s) is" " different from the selected journal " "(%(journal_selected)s).", @@ -252,7 +256,7 @@ def _match_journal(self, account_number, currency): ) if bank_accounts: raise UserError( - _( + self.env._( "The bank account with number '%(account_number)s'" " exists in Odoo but it is not set on any bank " "journal. You should set it on the related bank " @@ -263,7 +267,7 @@ def _match_journal(self, account_number, currency): ) else: raise UserError( - _( + self.env._( "Could not find any bank account with number " "'%(account_number)s' linked to partner '" "%(partner_name)s'. You should create the bank " @@ -281,7 +285,7 @@ def _match_journal(self, account_number, currency): journal_currency = journal.currency_id or company.currency_id if journal_currency != currency: raise UserError( - _( + self.env._( "The currency of the bank statement (%(currency_name)s) " "is not the same as the currency of the journal " "'%(journal_name)s' (%(journal_currency_name)s).", @@ -303,7 +307,7 @@ def _complete_stmts_vals(self, stmts_vals, journal, account_number): ) journal._statement_line_import_update_hook(lvals, speeddict) if not lvals.get("payment_ref"): - raise UserError(_("Missing payment_ref on a transaction.")) + raise UserError(self.env._("Missing payment_ref on a transaction.")) return stmts_vals def _create_bank_statements(self, stmts_vals, result): @@ -354,10 +358,12 @@ def _create_bank_statements(self, stmts_vals, result): num_ignored = len(existing_st_line_ids) if num_ignored > 0: if num_ignored == 1: - msg = _("1 transaction had already been imported and was ignored.") + msg = self.env._( + "1 transaction had already been imported and was ignored." + ) else: - msg = ( - _("%d transactions had already been imported and were ignored.") - % num_ignored + msg = self.env._( + "%d transactions had already been imported and were ignored.", + num_ignored, ) result["notifications"].append(msg) diff --git a/account_statement_import_file/wizard/account_statement_import_view.xml b/account_statement_import_file/wizard/account_statement_import_view.xml index f6e790e09..66f1fe68c 100644 --- a/account_statement_import_file/wizard/account_statement_import_view.xml +++ b/account_statement_import_file/wizard/account_statement_import_view.xml @@ -40,7 +40,7 @@ Import Statement - +