diff --git a/account_bank_statement_import_helper/README.rst b/account_bank_statement_import_helper/README.rst new file mode 100644 index 0000000..dbbf7b5 --- /dev/null +++ b/account_bank_statement_import_helper/README.rst @@ -0,0 +1,54 @@ +.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 + +============================ +Bank statement import helper +============================ + +This module enhances the standard bank statement import as follows: + +- support for local bank accounts as subset of IBAN accounts. + +Installation +============ + +There is no specific installation procedure for this module. + +Configuration and Usage +======================= + +.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas + :alt: Try me on Runbot + :target: https://runbot.odoo-community.org/runbot/174/10.0 + +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 smash it by providing detailed and welcomed feedback. + +Credits +======= + +Contributors +------------ + +* Luc De Meyer + +Maintainer +---------- + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +This module is maintained by the OCA. + +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. + +To contribute to this module, please visit http://odoo-community.org. diff --git a/account_bank_statement_import_helper/__init__.py b/account_bank_statement_import_helper/__init__.py new file mode 100644 index 0000000..02baef4 --- /dev/null +++ b/account_bank_statement_import_helper/__init__.py @@ -0,0 +1,2 @@ +# -*- coding: utf-8 -*- +from . import wizard diff --git a/account_bank_statement_import_helper/__manifest__.py b/account_bank_statement_import_helper/__manifest__.py new file mode 100644 index 0000000..bf181f2 --- /dev/null +++ b/account_bank_statement_import_helper/__manifest__.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Copyright 2009-2017 Noviat. +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +{ + 'name': 'Bank statement import helper', + 'version': '10.0.1.0.0', + 'category': 'Accounting & Finance', + 'summary': """ + Generic bank statement import improvements. + """, + 'author': 'Noviat,' + 'Odoo Community Association (OCA)', + 'website': 'https://github.com/OCA/bank-statement-import', + 'depends': [ + 'account_bank_statement_import', + ], + 'installable': True, + 'license': 'AGPL-3', +} diff --git a/account_bank_statement_import_helper/static/description/icon.png b/account_bank_statement_import_helper/static/description/icon.png new file mode 100644 index 0000000..3a0328b Binary files /dev/null and b/account_bank_statement_import_helper/static/description/icon.png differ diff --git a/account_bank_statement_import_helper/wizard/__init__.py b/account_bank_statement_import_helper/wizard/__init__.py new file mode 100644 index 0000000..5dfe830 --- /dev/null +++ b/account_bank_statement_import_helper/wizard/__init__.py @@ -0,0 +1,2 @@ +# -*- coding: utf-8 -*- +from . import account_bank_statement_import diff --git a/account_bank_statement_import_helper/wizard/account_bank_statement_import.py b/account_bank_statement_import_helper/wizard/account_bank_statement_import.py new file mode 100644 index 0000000..20ffb18 --- /dev/null +++ b/account_bank_statement_import_helper/wizard/account_bank_statement_import.py @@ -0,0 +1,38 @@ +# -*- coding: utf-8 -*- +# Copyright 2009-2017 Noviat. +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import models +from odoo.addons.base.res.res_bank import sanitize_account_number + + +class AccountBankStatementImport(models.TransientModel): + """ + add support for local bank account numbers which are in several + countries a subset of the IBAN + """ + _inherit = 'account.bank.statement.import' + + def _find_additional_data(self, currency_code, account_number): + currency, journal = super( + AccountBankStatementImport, self + )._find_additional_data(currency_code, account_number) + if not journal: + sanitized_account_number = sanitize_account_number(account_number) + fin_journals = self.env['account.journal'].search( + [('type', '=', 'bank')]) + fin_journal = fin_journals.filtered( + lambda r: sanitized_account_number + in r.bank_account_id.sanitized_acc_number) + if len(fin_journal) == 1: + journal = fin_journal + return currency, journal + + def _check_journal_bank_account(self, journal, account_number): + check = super( + AccountBankStatementImport, self + )._check_journal_bank_account(journal, account_number) + if not check: + check = account_number \ + in journal.bank_account_id.sanitized_acc_number + return check