diff --git a/account_statement_import_qif/README.rst b/account_statement_import_qif/README.rst
index d6af1ce7..e4801462 100644
--- a/account_statement_import_qif/README.rst
+++ b/account_statement_import_qif/README.rst
@@ -7,7 +7,7 @@ Import QIF Bank Statements
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- !! source digest: sha256:926bb5e821cd71d9a5bdaee546ce3b8f25a00825ff69c291da88820e8e53ae62
+ !! source digest: sha256:46da85f209ed418623ef45de4757c7ceb32bedf65df4d336d7f8a8473da6c1d0
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
@@ -17,13 +17,13 @@ Import QIF Bank Statements
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-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/13.0/account_bank_statement_import_qif
+ :target: https://github.com/OCA/bank-statement-import/tree/16.0/account_statement_import_qif
: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-13-0/bank-statement-import-13-0-account_bank_statement_import_qif
+ :target: https://translation.odoo-community.org/projects/bank-statement-import-16-0/bank-statement-import-16-0-account_statement_import_qif
: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=13.0
+ :target: https://runboat.odoo-community.org/builds?repo=OCA/bank-statement-import&target_branch=16.0
:alt: Try me on Runboat
|badge1| |badge2| |badge3| |badge4| |badge5|
@@ -64,7 +64,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.
@@ -107,6 +107,6 @@ 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.
-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_qif/__manifest__.py b/account_statement_import_qif/__manifest__.py
index 7f61a54c..c316a61b 100644
--- a/account_statement_import_qif/__manifest__.py
+++ b/account_statement_import_qif/__manifest__.py
@@ -7,11 +7,11 @@
{
"name": "Import QIF Bank Statements",
"category": "Accounting",
- "version": "13.0.1.0.0",
+ "version": "16.0.1.0.0",
"author": "OpenERP SA," "Tecnativa," "Odoo Community Association (OCA)",
"website": "https://github.com/OCA/bank-statement-import",
- "depends": ["account_bank_statement_import"],
- "data": ["wizards/account_bank_statement_import_qif_view.xml"],
+ "depends": ["account_statement_import_file"],
+ "data": ["wizards/account_statement_import_qif_view.xml"],
"installable": True,
"license": "AGPL-3",
}
diff --git a/account_statement_import_qif/static/description/index.html b/account_statement_import_qif/static/description/index.html
index 64b0b489..191ce05a 100644
--- a/account_statement_import_qif/static/description/index.html
+++ b/account_statement_import_qif/static/description/index.html
@@ -367,9 +367,9 @@ ul.auto-toc {
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-!! source digest: sha256:926bb5e821cd71d9a5bdaee546ce3b8f25a00825ff69c291da88820e8e53ae62
+!! source digest: sha256:46da85f209ed418623ef45de4757c7ceb32bedf65df4d336d7f8a8473da6c1d0
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
-

+

This module allows you to import the machine readable QIF Files in Odoo: they
are parsed and stored in human readable format in
Accounting Bank and Cash Bank Statements.
@@ -405,7 +405,7 @@ original AGPL code.
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.
@@ -448,7 +448,7 @@ If you spotted it first, help us to smash it by providing a detailed and welcome
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.
-
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_qif/tests/test_import_bank_statement.py b/account_statement_import_qif/tests/test_import_bank_statement.py
index c227f323..0a37d011 100644
--- a/account_statement_import_qif/tests/test_import_bank_statement.py
+++ b/account_statement_import_qif/tests/test_import_bank_statement.py
@@ -2,6 +2,7 @@
# Copyright 2015 Laurent Mignon
# Copyright 2015 Ronald Portier
# Copyright 2016-2017 Tecnativa - Pedro M. Baeza
+# Copyright 2024 Tecnativa - Víctor Martínez
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
import base64
@@ -15,14 +16,20 @@ class TestQifFile(TransactionCase):
(account.bank.statement.import)
"""
- def setUp(self):
- super().setUp()
- self.statement_import_model = self.env["account.bank.statement.import"]
- self.statement_line_model = self.env["account.bank.statement.line"]
- self.journal = self.env["account.journal"].create(
- {"name": "Test bank journal", "code": "TEST", "type": "bank"}
+ @classmethod
+ def setUpClass(cls):
+ super().setUpClass()
+ cls.statement_import_model = cls.env["account.statement.import"]
+ cls.statement_line_model = cls.env["account.bank.statement.line"]
+ cls.journal = cls.env["account.journal"].create(
+ {
+ "name": "Test bank journal",
+ "code": "TEST",
+ "type": "bank",
+ "currency_id": cls.env.company.currency_id.id,
+ }
)
- self.partner = self.env["res.partner"].create(
+ cls.partner = cls.env["res.partner"].create(
{
# Different case for trying insensitive case search
"name": "EPIC Technologies",
@@ -31,22 +38,22 @@ class TestQifFile(TransactionCase):
def test_qif_file_import(self):
qif_file_path = get_module_resource(
- "account_bank_statement_import_qif",
+ "account_statement_import_qif",
"tests",
"test_qif.qif",
)
qif_file = base64.b64encode(open(qif_file_path, "rb").read())
wizard = self.statement_import_model.with_context(
journal_id=self.journal.id
- ).create({"attachment_ids": [(0, 0, {"name": "test file", "datas": qif_file})]})
- wizard.import_file()
+ ).create({"statement_file": qif_file, "statement_filename": "test_qif.qif"})
+ wizard.import_file_button()
statement = self.statement_line_model.search(
- [("name", "=", "YOUR LOCAL SUPERMARKET")],
+ [("payment_ref", "=", "YOUR LOCAL SUPERMARKET")],
limit=1,
- )[0].statement_id
+ ).statement_id
self.assertAlmostEqual(statement.balance_end_real, -1896.09, 2)
line = self.statement_line_model.search(
- [("name", "=", "Epic Technologies")],
+ [("payment_ref", "=", "Epic Technologies")],
limit=1,
)
self.assertEqual(line.partner_id, self.partner)
diff --git a/account_statement_import_qif/wizards/__init__.py b/account_statement_import_qif/wizards/__init__.py
index 448bfc66..c075b9cf 100644
--- a/account_statement_import_qif/wizards/__init__.py
+++ b/account_statement_import_qif/wizards/__init__.py
@@ -1,3 +1,3 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
-from . import account_bank_statement_import_qif
+from . import account_statement_import_qif
diff --git a/account_statement_import_qif/wizards/account_bank_statement_import_qif.py b/account_statement_import_qif/wizards/account_statement_import_qif.py
similarity index 85%
rename from account_statement_import_qif/wizards/account_bank_statement_import_qif.py
rename to account_statement_import_qif/wizards/account_statement_import_qif.py
index aa4fde4e..42dc8527 100644
--- a/account_statement_import_qif/wizards/account_bank_statement_import_qif.py
+++ b/account_statement_import_qif/wizards/account_statement_import_qif.py
@@ -13,8 +13,8 @@ from odoo.exceptions import UserError
from odoo.tools.translate import _
-class AccountBankStatementImport(models.TransientModel):
- _inherit = "account.bank.statement.import"
+class AccountStatementImport(models.TransientModel):
+ _inherit = "account.statement.import"
@api.model
def _check_qif(self, data_file):
@@ -31,8 +31,8 @@ class AccountBankStatementImport(models.TransientModel):
data_list = file_data.split("\n")
header = data_list[0].strip()
header = header.split(":")[1]
- except Exception:
- raise UserError(_("Could not decipher the QIF file."))
+ except Exception as e:
+ raise UserError(_("Could not decipher the QIF file.")) from e
transactions = []
vals_line = {}
total = 0
@@ -52,13 +52,13 @@ class AccountBankStatementImport(models.TransientModel):
elif line[0] == "N": # Check number
vals_line["ref"] = line[1:]
elif line[0] == "P": # Payee
- vals_line["name"] = (
+ vals_line["payment_ref"] = (
"name" in vals_line
and line[1:] + ": " + vals_line["name"]
or line[1:]
)
elif line[0] == "M": # Memo
- vals_line["name"] = (
+ vals_line["payment_ref"] = (
"name" in vals_line
and vals_line["name"] + ": " + line[1:]
or line[1:]
@@ -80,7 +80,8 @@ class AccountBankStatementImport(models.TransientModel):
vals_bank_statement.update(
{"balance_end_real": total, "transactions": transactions}
)
- return None, None, [vals_bank_statement]
+ journal = self.env["account.journal"].browse(self.env.context.get("journal_id"))
+ return journal.currency_id.name, None, [vals_bank_statement]
def _complete_stmts_vals(self, stmt_vals, journal_id, account_number):
"""Match partner_id if hasn't been deducted yet."""
@@ -88,16 +89,16 @@ class AccountBankStatementImport(models.TransientModel):
# Since QIF doesn't provide account numbers (normal behaviour is to
# provide 'account_number', which the generic module uses to find
# the partner), we have to find res.partner through the name
- if not self.attachment_ids or not self._check_qif(
- base64.b64decode(self.attachment_ids[0].datas)
+ if not self.statement_file or not self._check_qif(
+ base64.b64decode(self.statement_file)
):
return res
partner_obj = self.env["res.partner"]
for statement in res:
for line_vals in statement["transactions"]:
- if not line_vals.get("partner_id") and line_vals.get("name"):
+ if not line_vals.get("partner_id") and line_vals.get("payment_ref"):
partner = partner_obj.search(
- [("name", "ilike", line_vals["name"])],
+ [("name", "ilike", line_vals["payment_ref"])],
limit=1,
)
line_vals["partner_id"] = partner.id
diff --git a/account_statement_import_qif/wizards/account_bank_statement_import_qif_view.xml b/account_statement_import_qif/wizards/account_statement_import_qif_view.xml
similarity index 58%
rename from account_statement_import_qif/wizards/account_bank_statement_import_qif_view.xml
rename to account_statement_import_qif/wizards/account_statement_import_qif_view.xml
index d9bdc4c0..ebc0ab3a 100644
--- a/account_statement_import_qif/wizards/account_bank_statement_import_qif_view.xml
+++ b/account_statement_import_qif/wizards/account_statement_import_qif_view.xml
@@ -1,11 +1,10 @@
-
-
- account.bank.statement.import
+
+ account.statement.import
@@ -13,5 +12,4 @@
-
diff --git a/setup/account_bank_statement_import_qif/odoo/addons/account_bank_statement_import_qif b/setup/account_bank_statement_import_qif/odoo/addons/account_bank_statement_import_qif
deleted file mode 120000
index 2f0b59da..00000000
--- a/setup/account_bank_statement_import_qif/odoo/addons/account_bank_statement_import_qif
+++ /dev/null
@@ -1 +0,0 @@
-../../../../account_bank_statement_import_qif
\ No newline at end of file
diff --git a/setup/account_statement_import_qif/odoo/addons/account_statement_import_qif b/setup/account_statement_import_qif/odoo/addons/account_statement_import_qif
new file mode 120000
index 00000000..d10fdade
--- /dev/null
+++ b/setup/account_statement_import_qif/odoo/addons/account_statement_import_qif
@@ -0,0 +1 @@
+../../../../account_statement_import_qif
\ No newline at end of file
diff --git a/setup/account_bank_statement_import_qif/setup.py b/setup/account_statement_import_qif/setup.py
similarity index 100%
rename from setup/account_bank_statement_import_qif/setup.py
rename to setup/account_statement_import_qif/setup.py