From 08e2a2643965059f64c520be86d545f7eabc155b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Didderen?= Date: Wed, 21 Jun 2023 11:17:14 +0200 Subject: [PATCH 01/51] [IMP] account_statement_import_txt_xlsx - improve column inheratibility --- .../account_statement_import_sheet_parser.py | 256 +++++++++--------- 1 file changed, 128 insertions(+), 128 deletions(-) diff --git a/account_statement_import_txt_xlsx/models/account_statement_import_sheet_parser.py b/account_statement_import_txt_xlsx/models/account_statement_import_sheet_parser.py index b629da86..ff7ac1ed 100644 --- a/account_statement_import_txt_xlsx/models/account_statement_import_sheet_parser.py +++ b/account_statement_import_txt_xlsx/models/account_statement_import_sheet_parser.py @@ -194,6 +194,131 @@ class AccountStatementImportSheetParser(models.TransientModel): return " ".join(content_l) return content_l[0] + def _parse_row(self, mapping, currency_code, values, columns): # noqa: C901 + timestamp = self._get_values_from_column(values, columns, "timestamp_column") + currency = ( + self._get_values_from_column(values, columns, "currency_column") + if columns["currency_column"] + else currency_code + ) + + def _decimal(column_name): + if columns[column_name]: + return self._parse_decimal( + self._get_values_from_column(values, columns, column_name), + mapping, + ) + + amount = _decimal("amount_column") + if not amount: + amount = abs(_decimal("amount_debit_column") or 0) + if not amount: + amount = -abs(_decimal("amount_credit_column") or 0) + + balance = ( + self._get_values_from_column(values, columns, "balance_column") + if columns["balance_column"] + else None + ) + original_currency = ( + self._get_values_from_column(values, columns, "original_currency_column") + if columns["original_currency_column"] + else None + ) + original_amount = ( + self._get_values_from_column(values, columns, "original_amount_column") + if columns["original_amount_column"] + else None + ) + debit_credit = ( + self._get_values_from_column(values, columns, "debit_credit_column") + if columns["debit_credit_column"] + else None + ) + transaction_id = ( + self._get_values_from_column(values, columns, "transaction_id_column") + if columns["transaction_id_column"] + else None + ) + description = ( + self._get_values_from_column(values, columns, "description_column") + if columns["description_column"] + else None + ) + notes = ( + self._get_values_from_column(values, columns, "notes_column") + if columns["notes_column"] + else None + ) + reference = ( + self._get_values_from_column(values, columns, "reference_column") + if columns["reference_column"] + else None + ) + partner_name = ( + self._get_values_from_column(values, columns, "partner_name_column") + if columns["partner_name_column"] + else None + ) + bank_name = ( + self._get_values_from_column(values, columns, "bank_name_column") + if columns["bank_name_column"] + else None + ) + bank_account = ( + self._get_values_from_column(values, columns, "bank_account_column") + if columns["bank_account_column"] + else None + ) + + if currency != currency_code: + return {} + + if isinstance(timestamp, str): + timestamp = datetime.strptime(timestamp, mapping.timestamp_format) + + if balance: + balance = self._parse_decimal(balance, mapping) + else: + balance = None + + if debit_credit: + amount = amount.copy_abs() + if debit_credit == mapping.debit_value: + amount = -amount + + if original_amount: + original_amount = self._parse_decimal(original_amount, mapping).copy_sign( + amount + ) + else: + original_amount = 0.0 + + line = { + "timestamp": timestamp, + "amount": amount, + "currency": currency, + "original_amount": original_amount, + "original_currency": original_currency, + } + if balance is not None: + line["balance"] = balance + if transaction_id is not None: + line["transaction_id"] = transaction_id + if description is not None: + line["description"] = description + if notes is not None: + line["notes"] = notes + if reference is not None: + line["reference"] = reference + if partner_name is not None: + line["partner_name"] = partner_name + if bank_name is not None: + line["bank_name"] = bank_name + if bank_account is not None: + line["bank_account"] = bank_account + return line + def _parse_rows(self, mapping, currency_code, csv_or_xlsx, columns): # noqa: C901 if isinstance(csv_or_xlsx, tuple): rows = range(1, csv_or_xlsx[1].nrows) @@ -214,134 +339,9 @@ class AccountStatementImportSheetParser(models.TransientModel): values.append(cell_value) else: values = list(row) - - timestamp = self._get_values_from_column( - values, columns, "timestamp_column" - ) - currency = ( - self._get_values_from_column(values, columns, "currency_column") - if columns["currency_column"] - else currency_code - ) - - def _decimal(column_name): - if columns[column_name]: - return self._parse_decimal( - self._get_values_from_column(values, columns, column_name), - mapping, - ) - - amount = _decimal("amount_column") - if not amount: - amount = abs(_decimal("amount_debit_column") or 0) - if not amount: - amount = -abs(_decimal("amount_credit_column") or 0) - - balance = ( - self._get_values_from_column(values, columns, "balance_column") - if columns["balance_column"] - else None - ) - original_currency = ( - self._get_values_from_column( - values, columns, "original_currency_column" - ) - if columns["original_currency_column"] - else None - ) - original_amount = ( - self._get_values_from_column(values, columns, "original_amount_column") - if columns["original_amount_column"] - else None - ) - debit_credit = ( - self._get_values_from_column(values, columns, "debit_credit_column") - if columns["debit_credit_column"] - else None - ) - transaction_id = ( - self._get_values_from_column(values, columns, "transaction_id_column") - if columns["transaction_id_column"] - else None - ) - description = ( - self._get_values_from_column(values, columns, "description_column") - if columns["description_column"] - else None - ) - notes = ( - self._get_values_from_column(values, columns, "notes_column") - if columns["notes_column"] - else None - ) - reference = ( - self._get_values_from_column(values, columns, "reference_column") - if columns["reference_column"] - else None - ) - partner_name = ( - self._get_values_from_column(values, columns, "partner_name_column") - if columns["partner_name_column"] - else None - ) - bank_name = ( - self._get_values_from_column(values, columns, "bank_name_column") - if columns["bank_name_column"] - else None - ) - bank_account = ( - self._get_values_from_column(values, columns, "bank_account_column") - if columns["bank_account_column"] - else None - ) - - if currency != currency_code: - continue - - if isinstance(timestamp, str): - timestamp = datetime.strptime(timestamp, mapping.timestamp_format) - - if balance: - balance = self._parse_decimal(balance, mapping) - else: - balance = None - - if debit_credit: - amount = amount.copy_abs() - if debit_credit == mapping.debit_value: - amount = -amount - - if original_amount: - original_amount = self._parse_decimal( - original_amount, mapping - ).copy_sign(amount) - else: - original_amount = 0.0 - - line = { - "timestamp": timestamp, - "amount": amount, - "currency": currency, - "original_amount": original_amount, - "original_currency": original_currency, - } - if balance is not None: - line["balance"] = balance - if transaction_id is not None: - line["transaction_id"] = transaction_id - if description is not None: - line["description"] = description - if notes is not None: - line["notes"] = notes - if reference is not None: - line["reference"] = reference - if partner_name is not None: - line["partner_name"] = partner_name - if bank_name is not None: - line["bank_name"] = bank_name - if bank_account is not None: - line["bank_account"] = bank_account - lines.append(line) + line = self._parse_row(mapping, currency_code, values, columns) + if line: + lines.append(line) return lines @api.model From f3c794802a552257f062397cbb03ba3654fd55e4 Mon Sep 17 00:00:00 2001 From: OCA-git-bot Date: Wed, 21 Jun 2023 12:40:19 +0000 Subject: [PATCH 02/51] account_statement_import_txt_xlsx 14.0.3.1.0 --- account_statement_import_txt_xlsx/__manifest__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/account_statement_import_txt_xlsx/__manifest__.py b/account_statement_import_txt_xlsx/__manifest__.py index f97045bd..f9f69377 100644 --- a/account_statement_import_txt_xlsx/__manifest__.py +++ b/account_statement_import_txt_xlsx/__manifest__.py @@ -5,7 +5,7 @@ { "name": "Bank Statement TXT/CSV/XLSX Import", "summary": "Import TXT/CSV or XLSX files as Bank Statements in Odoo", - "version": "14.0.3.0.1", + "version": "14.0.3.1.0", "category": "Accounting", "website": "https://github.com/OCA/bank-statement-import", "author": "ForgeFlow, CorporateHub, Odoo Community Association (OCA)", From 30112ac9f68da91387f46e336e70975b965f70ed Mon Sep 17 00:00:00 2001 From: OCA-git-bot Date: Wed, 21 Jun 2023 12:40:24 +0000 Subject: [PATCH 03/51] [UPD] addons table in README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d411a6bc..95d9fc0e 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ addon | version | maintainers | summary [account_statement_import_online_ponto](account_statement_import_online_ponto/) | 14.0.2.0.0 | | Online Bank Statements: MyPonto.com [account_statement_import_online_ponto_ing](account_statement_import_online_ponto_ing/) | 14.0.1.0.0 | | Online Bank Statements: MyPonto.com ING customization [account_statement_import_paypal](account_statement_import_paypal/) | 14.0.1.0.1 | | Import PayPal CSV files as Bank Statements in Odoo -[account_statement_import_txt_xlsx](account_statement_import_txt_xlsx/) | 14.0.3.0.1 | [![alexey-pelykh](https://github.com/alexey-pelykh.png?size=30px)](https://github.com/alexey-pelykh) | Import TXT/CSV or XLSX files as Bank Statements in Odoo +[account_statement_import_txt_xlsx](account_statement_import_txt_xlsx/) | 14.0.3.1.0 | [![alexey-pelykh](https://github.com/alexey-pelykh.png?size=30px)](https://github.com/alexey-pelykh) | Import TXT/CSV or XLSX files as Bank Statements in Odoo [//]: # (end addons) From 81a1801590fd6f6d0d6d6ba20a9f49f5282fded8 Mon Sep 17 00:00:00 2001 From: eccit-quim Date: Fri, 23 Jun 2023 10:36:58 +0000 Subject: [PATCH 04/51] Translated using Weblate (Catalan) Currently translated at 100.0% (10 of 10 strings) Translation: bank-statement-import-14.0/bank-statement-import-14.0-account_statement_import_camt54 Translate-URL: https://translation.odoo-community.org/projects/bank-statement-import-14-0/bank-statement-import-14-0-account_statement_import_camt54/ca/ --- account_statement_import_camt54/i18n/ca.po | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/account_statement_import_camt54/i18n/ca.po b/account_statement_import_camt54/i18n/ca.po index 7c78db0c..d47879b4 100644 --- a/account_statement_import_camt54/i18n/ca.po +++ b/account_statement_import_camt54/i18n/ca.po @@ -6,15 +6,15 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 14.0\n" "Report-Msgid-Bugs-To: \n" -"PO-Revision-Date: 2022-03-21 14:17+0000\n" -"Last-Translator: Noel estudillo \n" +"PO-Revision-Date: 2023-06-23 13:08+0000\n" +"Last-Translator: eccit-quim \n" "Language-Team: none\n" "Language: ca\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: \n" "Plural-Forms: nplurals=2; plural=n != 1;\n" -"X-Generator: Weblate 4.3.2\n" +"X-Generator: Weblate 4.17\n" #. module: account_statement_import_camt54 #: model:ir.model,name:account_statement_import_camt54.model_account_statement_import_camt_parser @@ -85,7 +85,7 @@ msgstr "Importa fitxers d'extractes bancaris" #. module: account_statement_import_camt54 #: model:ir.model,name:account_statement_import_camt54.model_account_journal msgid "Journal" -msgstr "Revista" +msgstr "Diari" #. module: account_statement_import_camt54 #: model:ir.model.fields,field_description:account_statement_import_camt54.field_account_journal____last_update From 302c2b0bd987b0560974a159fa23b3d72daa7a57 Mon Sep 17 00:00:00 2001 From: OCA-git-bot Date: Sun, 3 Sep 2023 11:51:52 +0000 Subject: [PATCH 05/51] [UPD] README.rst --- account_statement_import/README.rst | 15 +++--- .../static/description/index.html | 40 +++++++------- account_statement_import_base/README.rst | 15 +++--- .../static/description/index.html | 36 +++++++------ account_statement_import_camt/README.rst | 15 +++--- .../static/description/index.html | 34 ++++++------ account_statement_import_camt54/README.rst | 15 +++--- .../static/description/index.html | 38 ++++++------- .../README.rst | 15 +++--- .../static/description/index.html | 40 +++++++------- account_statement_import_move_line/README.rst | 15 +++--- .../static/description/index.html | 44 +++++++-------- account_statement_import_ofx/README.rst | 15 +++--- .../static/description/index.html | 38 ++++++------- .../README.rst | 15 +++--- .../static/description/index.html | 34 ++++++------ account_statement_import_online/README.rst | 15 +++--- .../static/description/index.html | 44 +++++++-------- .../README.rst | 15 +++--- .../static/description/index.html | 48 +++++++++-------- .../README.rst | 15 +++--- .../static/description/index.html | 42 ++++++++------- .../README.rst | 15 +++--- .../static/description/index.html | 38 ++++++------- account_statement_import_paypal/README.rst | 15 +++--- .../static/description/index.html | 52 +++++++++--------- account_statement_import_txt_xlsx/README.rst | 15 +++--- .../static/description/index.html | 54 ++++++++++--------- 28 files changed, 431 insertions(+), 361 deletions(-) diff --git a/account_statement_import/README.rst b/account_statement_import/README.rst index 436fda3a..49d765cb 100644 --- a/account_statement_import/README.rst +++ b/account_statement_import/README.rst @@ -2,10 +2,13 @@ Import Statement Files ====================== -.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:892584d9edffc0166335bf92634566cbf1b4c90d44b0bae10e158ba2fce290c2 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. |badge1| image:: https://img.shields.io/badge/maturity-Mature-brightgreen.png :target: https://odoo-community.org/page/development-status @@ -19,11 +22,11 @@ Import Statement Files .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png :target: https://translation.odoo-community.org/projects/bank-statement-import-14-0/bank-statement-import-14-0-account_statement_import :alt: Translate me on Weblate -.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png - :target: https://runbot.odoo-community.org/runbot/174/14.0 - :alt: Try me on Runbot +.. |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=14.0 + :alt: Try me on Runboat -|badge1| |badge2| |badge3| |badge4| |badge5| +|badge1| |badge2| |badge3| |badge4| |badge5| 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 commit `_). We decided to change its name and the name of the wizard object it provides in order to avoid a conflict with the Enterprise module. @@ -54,7 +57,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 smashing it by providing a detailed and welcomed +If you spotted it first, help us to smash it by providing a detailed and welcomed `feedback `_. Do not contact contributors directly about support or help with technical issues. diff --git a/account_statement_import/static/description/index.html b/account_statement_import/static/description/index.html index 2257da27..4502fbe2 100644 --- a/account_statement_import/static/description/index.html +++ b/account_statement_import/static/description/index.html @@ -1,20 +1,20 @@ - + - + Import Statement Files