[IMP] account_bank_statement_import_qif: pre-commit stuff

This commit is contained in:
Víctor Martínez
2024-04-03 09:30:43 +02:00
parent 0915901917
commit cc87171aad
4 changed files with 16 additions and 4 deletions

View File

@@ -31,7 +31,9 @@ class TestQifFile(TransactionCase):
def test_qif_file_import(self):
qif_file_path = get_module_resource(
"account_bank_statement_import_qif", "tests", "test_qif.qif",
"account_bank_statement_import_qif",
"tests",
"test_qif.qif",
)
qif_file = base64.b64encode(open(qif_file_path, "rb").read())
wizard = self.statement_import_model.with_context(
@@ -39,10 +41,12 @@ class TestQifFile(TransactionCase):
).create({"attachment_ids": [(0, 0, {"name": "test file", "datas": qif_file})]})
wizard.import_file()
statement = self.statement_line_model.search(
[("name", "=", "YOUR LOCAL SUPERMARKET")], limit=1,
[("name", "=", "YOUR LOCAL SUPERMARKET")],
limit=1,
)[0].statement_id
self.assertAlmostEqual(statement.balance_end_real, -1896.09, 2)
line = self.statement_line_model.search(
[("name", "=", "Epic Technologies")], limit=1,
[("name", "=", "Epic Technologies")],
limit=1,
)
self.assertEqual(line.partner_id, self.partner)

View File

@@ -97,7 +97,8 @@ class AccountBankStatementImport(models.TransientModel):
for line_vals in statement["transactions"]:
if not line_vals.get("partner_id") and line_vals.get("name"):
partner = partner_obj.search(
[("name", "ilike", line_vals["name"])], limit=1,
[("name", "ilike", line_vals["name"])],
limit=1,
)
line_vals["partner_id"] = partner.id
return res

View File

@@ -0,0 +1 @@
../../../../account_bank_statement_import_qif

View File

@@ -0,0 +1,6 @@
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)