Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[16.0][FIX] account_statement_base: Changes post OCA CR #6

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 22 additions & 41 deletions account_statement_base/tests/test_account_statement_base.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from odoo import Command
from odoo.tests import tagged

from odoo.addons.account.tests.common import TestAccountReconciliationCommon
Expand Down Expand Up @@ -28,45 +29,23 @@ def setUpClass(cls, chart_template_ref=None):
)
cls.non_current_assets_account.reconcile = True

def test01_open_entries(self):
statement = self.acc_bank_stmt_model.create(
{
"name": "Test Bank Statement",
}
)
domain = [
"&",
("parent_state", "=", "posted"),
("statement_id", "=", statement.id),
]
result = statement.open_entries()
self.assertTrue(result)
self.assertEqual(result.get("res_model"), "account.move.line")
self.assertEqual(result.get("context").get("search_default_group_by_move"), 1)
self.assertEqual(result.get("context").get("expand"), 1)
self.assertEqual(result.get("domain"), domain)

def test02_open_entries(self):
def test_01_test_open_entries(self):
move = self.account_move_model.create(
{
"line_ids": [
(
0,
0,
Command.create(
{
"account_id": self.current_assets_account.id,
"name": "DEMO",
"credit": 100,
},
}
),
(
0,
0,
Command.create(
{
"account_id": self.non_current_assets_account.id,
"name": "DEMO",
"debit": 100,
},
}
),
]
}
Expand All @@ -76,34 +55,36 @@ def test02_open_entries(self):
{
"name": "Test Bank Statement",
"line_ids": [
(
0,
0,
Command.create(
{
"date": "2024-01-01",
"amount": 100.0,
"payment_ref": move.name,
"line_ids": [
(4, move.line_ids[0].id),
],
},
"line_ids": [Command.set([move.line_ids[0].id])],
}
),
(
0,
0,
Command.create(
{
"date": "2024-01-01",
"amount": 100.0,
"payment_ref": move.name,
"line_ids": [
(4, move.line_ids[1].id),
],
},
"line_ids": [Command.set([move.line_ids[1].id])],
}
),
],
}
)
domain = [
"&",
("parent_state", "=", "posted"),
("statement_id", "=", statement.id),
]
result = statement.open_entries()
move_lines = self.env[result["res_model"]].search(result["domain"])
self.assertTrue(result)
self.assertEqual(result.get("res_model"), "account.move.line")
self.assertEqual(result.get("context").get("search_default_group_by_move"), 1)
self.assertEqual(result.get("context").get("expand"), 1)
self.assertEqual(result.get("domain"), domain)
self.assertIn(statement.line_ids.line_ids[0], move_lines)
self.assertIn(statement.line_ids.line_ids[1], move_lines)
Loading