diff --git a/l10n_es_account_statement_import_n43_overlap/README.rst b/l10n_es_account_statement_import_n43_overlap/README.rst new file mode 100644 index 000000000..4dfff630b --- /dev/null +++ b/l10n_es_account_statement_import_n43_overlap/README.rst @@ -0,0 +1,64 @@ +================================= +Bank statement import N43 overlap +================================= + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:24d0223ffe33b6875b3fc1d6ea9f568d000b37009c58dbdfb07246c3539880f9 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-NuoBiT%2Fodoo--addons-lightgray.png?logo=github + :target: https://github.com/NuoBiT/odoo-addons/tree/18.0/l10n_es_account_statement_import_n43_overlap + :alt: NuoBiT/odoo-addons + +|badge1| |badge2| |badge3| + +This module extends functionality of N43 bank statements checking +overlapping dates + +**Table of contents** + +.. contents:: + :local: + +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 `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +------- + +* NuoBiT Solutions SL + +Contributors +------------ + +- `NuoBiT `__: + + - Eric Antones eantones@nuobit.com + - Deniz Gallo dgallo@nuobit.com + +Maintainers +----------- + +This module is part of the `NuoBiT/odoo-addons `_ project on GitHub. + +You are welcome to contribute. diff --git a/l10n_es_account_statement_import_n43_overlap/__init__.py b/l10n_es_account_statement_import_n43_overlap/__init__.py new file mode 100644 index 000000000..f9a7ce911 --- /dev/null +++ b/l10n_es_account_statement_import_n43_overlap/__init__.py @@ -0,0 +1,3 @@ +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl) + +from . import wizards diff --git a/l10n_es_account_statement_import_n43_overlap/__manifest__.py b/l10n_es_account_statement_import_n43_overlap/__manifest__.py new file mode 100644 index 000000000..8a718d915 --- /dev/null +++ b/l10n_es_account_statement_import_n43_overlap/__manifest__.py @@ -0,0 +1,20 @@ +# Copyright NuoBiT Solutions - Eric Antones +# Copyright 2025 NuoBiT Solutions - Deniz Gallo +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl) + +{ + "name": "Bank statement import N43 overlap", + "summary": "This module extends functionality of N43 bank statements" + " checking overlapping dates", + "version": "18.0.1.0.0", + "author": "NuoBiT Solutions SL", + "website": "https://github.com/NuoBiT/odoo-addons", + "category": "Accounting & Finance", + "license": "AGPL-3", + "depends": [ + "l10n_es_account_statement_import_n43", + ], + "data": [ + "wizards/account_bank_statement_import_view.xml", + ], +} diff --git a/l10n_es_account_statement_import_n43_overlap/i18n/ca.po b/l10n_es_account_statement_import_n43_overlap/i18n/ca.po new file mode 100644 index 000000000..a43bdec87 --- /dev/null +++ b/l10n_es_account_statement_import_n43_overlap/i18n/ca.po @@ -0,0 +1,47 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * l10n_es_account_statement_import_n43_overlap +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 18.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2022-04-04 16:38+0000\n" +"PO-Revision-Date: 2022-04-04 16:38+0000\n" +"Last-Translator: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: l10n_es_account_statement_import_n43_overlap +#: model:ir.model.fields,field_description:l10n_es_account_statement_import_n43_overlap.field_account_statement_import__check_dates +msgid "Check dates" +msgstr "Comprovar dates" + +#. module: l10n_es_account_statement_import_n43_overlap +#: model:ir.model.fields,field_description:l10n_es_account_statement_import_n43_overlap.field_account_statement_import__display_name +msgid "Display Name" +msgstr "Mostrar Nom" + +#. module: l10n_es_account_statement_import_n43_overlap +#: model:ir.model.fields,field_description:l10n_es_account_statement_import_n43_overlap.field_account_statement_import__id +msgid "ID" +msgstr "" + +#. module: l10n_es_account_statement_import_n43_overlap +#: model:ir.model,name:l10n_es_account_statement_import_n43_overlap.model_account_statement_import +msgid "Import Bank Statement Files" +msgstr "Fitxers d'importació d'extractes bancaris" + +#. module: l10n_es_account_statement_import_n43_overlap +#: code:addons/l10n_es_account_statement_import_n43_overlap/wizards/account_bank_statement_import.py:0 +#, python-format +msgid "Imported file overlaps with existing Bank statement: %s" +msgstr "" + +#. module: l10n_es_account_statement_import_n43_overlap +#: model:ir.model.fields,field_description:l10n_es_account_statement_import_n43_overlap.field_account_statement_import____last_update +msgid "Last Modified on" +msgstr "Última modificació el" diff --git a/l10n_es_account_statement_import_n43_overlap/i18n/es.po b/l10n_es_account_statement_import_n43_overlap/i18n/es.po new file mode 100644 index 000000000..6513b066e --- /dev/null +++ b/l10n_es_account_statement_import_n43_overlap/i18n/es.po @@ -0,0 +1,47 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * l10n_es_account_statement_import_n43_overlap +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 18.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2022-04-04 16:37+0000\n" +"PO-Revision-Date: 2022-04-04 16:37+0000\n" +"Last-Translator: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: l10n_es_account_statement_import_n43_overlap +#: model:ir.model.fields,field_description:l10n_es_account_statement_import_n43_overlap.field_account_statement_import__check_dates +msgid "Check dates" +msgstr "Comprobar fechas" + +#. module: l10n_es_account_statement_import_n43_overlap +#: model:ir.model.fields,field_description:l10n_es_account_statement_import_n43_overlap.field_account_statement_import__display_name +msgid "Display Name" +msgstr "Nombre mostrado" + +#. module: l10n_es_account_statement_import_n43_overlap +#: model:ir.model.fields,field_description:l10n_es_account_statement_import_n43_overlap.field_account_statement_import__id +msgid "ID" +msgstr "" + +#. module: l10n_es_account_statement_import_n43_overlap +#: model:ir.model,name:l10n_es_account_statement_import_n43_overlap.model_account_statement_import +msgid "Import Bank Statement Files" +msgstr "Importar extracto bancario" + +#. module: l10n_es_account_statement_import_n43_overlap +#: code:addons/l10n_es_account_statement_import_n43_overlap/wizards/account_bank_statement_import.py:0 +#, python-format +msgid "Imported file overlaps with existing Bank statement: %s" +msgstr "El fichero importado se solapa con un Extracto Bancario existente: %s" + +#. module: l10n_es_account_statement_import_n43_overlap +#: model:ir.model.fields,field_description:l10n_es_account_statement_import_n43_overlap.field_account_statement_import____last_update +msgid "Last Modified on" +msgstr "Última modificación" diff --git a/l10n_es_account_statement_import_n43_overlap/pyproject.toml b/l10n_es_account_statement_import_n43_overlap/pyproject.toml new file mode 100644 index 000000000..4231d0ccc --- /dev/null +++ b/l10n_es_account_statement_import_n43_overlap/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/l10n_es_account_statement_import_n43_overlap/readme/CONTRIBUTORS.md b/l10n_es_account_statement_import_n43_overlap/readme/CONTRIBUTORS.md new file mode 100644 index 000000000..909507cba --- /dev/null +++ b/l10n_es_account_statement_import_n43_overlap/readme/CONTRIBUTORS.md @@ -0,0 +1,3 @@ +- [NuoBiT](https://www.nuobit.com): + - Eric Antones + - Deniz Gallo diff --git a/l10n_es_account_statement_import_n43_overlap/readme/DESCRIPTION.md b/l10n_es_account_statement_import_n43_overlap/readme/DESCRIPTION.md new file mode 100644 index 000000000..11784226e --- /dev/null +++ b/l10n_es_account_statement_import_n43_overlap/readme/DESCRIPTION.md @@ -0,0 +1 @@ +This module extends functionality of N43 bank statements checking overlapping dates diff --git a/l10n_es_account_statement_import_n43_overlap/static/description/icon.png b/l10n_es_account_statement_import_n43_overlap/static/description/icon.png new file mode 100644 index 000000000..1cd641e79 Binary files /dev/null and b/l10n_es_account_statement_import_n43_overlap/static/description/icon.png differ diff --git a/l10n_es_account_statement_import_n43_overlap/static/description/index.html b/l10n_es_account_statement_import_n43_overlap/static/description/index.html new file mode 100644 index 000000000..a8edac337 --- /dev/null +++ b/l10n_es_account_statement_import_n43_overlap/static/description/index.html @@ -0,0 +1,421 @@ + + + + + +Bank statement import N43 overlap + + + +
+

Bank statement import N43 overlap

+ + +

Beta License: AGPL-3 NuoBiT/odoo-addons

+

This module extends functionality of N43 bank statements checking +overlapping dates

+

Table of contents

+ +
+

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.

+

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

+
+
+

Credits

+
+

Authors

+
    +
  • NuoBiT Solutions SL
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is part of the NuoBiT/odoo-addons project on GitHub.

+

You are welcome to contribute.

+
+
+
+ + diff --git a/l10n_es_account_statement_import_n43_overlap/wizards/__init__.py b/l10n_es_account_statement_import_n43_overlap/wizards/__init__.py new file mode 100644 index 000000000..7dafcd167 --- /dev/null +++ b/l10n_es_account_statement_import_n43_overlap/wizards/__init__.py @@ -0,0 +1 @@ +from . import account_bank_statement_import diff --git a/l10n_es_account_statement_import_n43_overlap/wizards/account_bank_statement_import.py b/l10n_es_account_statement_import_n43_overlap/wizards/account_bank_statement_import.py new file mode 100644 index 000000000..4193838a5 --- /dev/null +++ b/l10n_es_account_statement_import_n43_overlap/wizards/account_bank_statement_import.py @@ -0,0 +1,40 @@ +# Copyright NuoBiT Solutions - Eric Antones +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl) + +from odoo import _, fields, models +from odoo.exceptions import ValidationError + + +class AccountBankStatementImport(models.TransientModel): + _inherit = "account.statement.import" + + check_dates = fields.Boolean(string="Check dates", default=True) + + def _complete_stmts_vals(self, stmts_vals, journal, account_number): + res = super()._complete_stmts_vals(stmts_vals, journal, account_number) + + if self.check_dates: + # get max and min date for imported bank statement + imp_dates = set() + for st_vals in res: + for line_vals in st_vals["transactions"]: + imp_dates.add(fields.Date.from_string(line_vals["date"])) + imp_min_date, imp_max_date = min(imp_dates), max(imp_dates) + + # check max and min date for each existing bank statement + for bs in self.env["account.bank.statement"].search( + [("journal_id", "=", journal.id)] + ): + bs_dates = [x.date for x in bs.line_ids] + bs_min_date, bs_max_date = min(bs_dates), max(bs_dates) + if bs_max_date >= imp_min_date and bs_min_date <= imp_max_date: + lang = self.env["res.lang"].search([("code", "=", self.env.lang)]) + bs_display_name = [bs.date.strftime(lang.date_format)] + if bs.name: + bs_display_name.append(f"({bs.name})") + raise ValidationError( + _("Imported file overlaps with existing Bank statement: %s") + % " ".join(bs_display_name) + ) + + return res diff --git a/l10n_es_account_statement_import_n43_overlap/wizards/account_bank_statement_import_view.xml b/l10n_es_account_statement_import_n43_overlap/wizards/account_bank_statement_import_view.xml new file mode 100644 index 000000000..02522bb27 --- /dev/null +++ b/l10n_es_account_statement_import_n43_overlap/wizards/account_bank_statement_import_view.xml @@ -0,0 +1,19 @@ + + + + + account.statement.import + + + + + + + + + +