Skip to content

Commit

Permalink
fixup! [ADD] import analytic accounts (KOST1/2)
Browse files Browse the repository at this point in the history
  • Loading branch information
hbrunn committed Sep 4, 2023
1 parent d63eac4 commit d699099
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
7 changes: 5 additions & 2 deletions datev_import_csv_dtvf/tests/test_datev_import_csv_dtvf.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ def setUp(self):
)
self.env["account.account"].search([("code", "=", "7095")]).code = "7095000"
self.env["account.account"].search([("code", "=", "1700")]).code = "170"
self.env["account.account"].search(
[("code", "=", "4900")]
).account_type = "income"
for code in ("4811",):
if self.env["account.analytic.account"].search(
[
Expand Down Expand Up @@ -129,8 +132,8 @@ def test_wizard(self):
self.assertEqual(last_line.account_id.code, "2450")
self.assertEqual(last_line.debit, 72)
analytic_lines = move.line_ids.mapped("analytic_line_ids")
self.assertEqual(len(analytic_lines), 2)
self.assertEqual(sum(analytic_lines.mapped("amount")), 0)
self.assertEqual(len(analytic_lines), 1)
self.assertEqual(sum(analytic_lines.mapped("amount")), 0.01)

def test_wizard_broken_file(self):
wizard = self.env["account.move.import"].create(
Expand Down
14 changes: 14 additions & 0 deletions datev_import_csv_dtvf/wizard/import_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,13 @@ def _prepare_move_line_01(self, pivot_line, sequence, indicator):
"analytic_account_2_id",
)
if pivot_line.get(analytic_account_id_field)
and self.env["account.account"]
.browse(pivot_line["account_id"])
.account_type
in (
"income",
"expense",
)
},
}
)
Expand Down Expand Up @@ -475,6 +482,13 @@ def _prepare_move_line_02(self, pivot_line, sequence, indicator):
"analytic_account_2_id",
)
if pivot_line.get(analytic_account_id_field)
and self.env["account.account"]
.browse(pivot_line["contra_account_id"])
.account_type
in (
"income",
"expense",
)
},
}
)
Expand Down

0 comments on commit d699099

Please sign in to comment.