odoo-addon-account-financial-report 15.0.1.1.0.1__py3-none-any.whl → 18.0.1.4.4.3__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) hide show
  1. odoo/addons/account_financial_report/README.rst +131 -74
  2. odoo/addons/account_financial_report/__manifest__.py +6 -9
  3. odoo/addons/account_financial_report/i18n/account_financial_report.pot +313 -188
  4. odoo/addons/account_financial_report/i18n/ar.po +579 -433
  5. odoo/addons/account_financial_report/i18n/ca.po +474 -289
  6. odoo/addons/account_financial_report/i18n/{fr_FR.po → ca_AD.po} +539 -491
  7. odoo/addons/account_financial_report/i18n/ca_ES.po +1891 -0
  8. odoo/addons/account_financial_report/i18n/de.po +455 -295
  9. odoo/addons/account_financial_report/i18n/es.po +458 -394
  10. odoo/addons/account_financial_report/i18n/es_AR.po +464 -283
  11. odoo/addons/account_financial_report/i18n/es_MX.po +315 -220
  12. odoo/addons/account_financial_report/i18n/fr.po +620 -435
  13. odoo/addons/account_financial_report/i18n/fr_CH.po +616 -462
  14. odoo/addons/account_financial_report/i18n/hr.po +506 -355
  15. odoo/addons/account_financial_report/i18n/hr_HR.po +331 -232
  16. odoo/addons/account_financial_report/i18n/it.po +538 -356
  17. odoo/addons/account_financial_report/i18n/ja.po +339 -240
  18. odoo/addons/account_financial_report/i18n/nl.po +462 -324
  19. odoo/addons/account_financial_report/i18n/nl_NL.po +318 -220
  20. odoo/addons/account_financial_report/i18n/pt.po +429 -242
  21. odoo/addons/account_financial_report/i18n/pt_BR.po +588 -438
  22. odoo/addons/account_financial_report/i18n/ro.po +499 -342
  23. odoo/addons/account_financial_report/i18n/sl.po +1945 -0
  24. odoo/addons/account_financial_report/i18n/sv.po +1997 -0
  25. odoo/addons/account_financial_report/i18n/tr.po +1947 -0
  26. odoo/addons/account_financial_report/menuitems.xml +1 -1
  27. odoo/addons/account_financial_report/models/__init__.py +2 -0
  28. odoo/addons/account_financial_report/models/account_age_report_configuration.py +49 -0
  29. odoo/addons/account_financial_report/models/account_group.py +62 -23
  30. odoo/addons/account_financial_report/models/account_move_line.py +33 -3
  31. odoo/addons/account_financial_report/models/ir_actions_report.py +6 -4
  32. odoo/addons/account_financial_report/models/res_config_settings.py +36 -0
  33. odoo/addons/account_financial_report/readme/CONFIGURE.md +26 -0
  34. odoo/addons/account_financial_report/readme/CONTRIBUTORS.md +38 -0
  35. odoo/addons/account_financial_report/readme/CREDITS.md +1 -0
  36. odoo/addons/account_financial_report/readme/DESCRIPTION.md +21 -0
  37. odoo/addons/account_financial_report/readme/HISTORY.md +16 -0
  38. odoo/addons/account_financial_report/readme/ROADMAP.md +6 -0
  39. odoo/addons/account_financial_report/report/abstract_report.py +73 -23
  40. odoo/addons/account_financial_report/report/abstract_report_xlsx.py +28 -23
  41. odoo/addons/account_financial_report/report/aged_partner_balance.py +131 -30
  42. odoo/addons/account_financial_report/report/aged_partner_balance_xlsx.py +158 -118
  43. odoo/addons/account_financial_report/report/general_ledger.py +421 -340
  44. odoo/addons/account_financial_report/report/general_ledger_xlsx.py +127 -75
  45. odoo/addons/account_financial_report/report/journal_ledger.py +84 -68
  46. odoo/addons/account_financial_report/report/journal_ledger_xlsx.py +14 -8
  47. odoo/addons/account_financial_report/report/open_items.py +113 -70
  48. odoo/addons/account_financial_report/report/open_items_xlsx.py +152 -19
  49. odoo/addons/account_financial_report/report/templates/aged_partner_balance.xml +408 -311
  50. odoo/addons/account_financial_report/report/templates/general_ledger.xml +273 -213
  51. odoo/addons/account_financial_report/report/templates/journal_ledger.xml +70 -76
  52. odoo/addons/account_financial_report/report/templates/layouts.xml +12 -1
  53. odoo/addons/account_financial_report/report/templates/open_items.xml +181 -55
  54. odoo/addons/account_financial_report/report/templates/trial_balance.xml +304 -195
  55. odoo/addons/account_financial_report/report/templates/vat_report.xml +10 -10
  56. odoo/addons/account_financial_report/report/trial_balance.py +463 -211
  57. odoo/addons/account_financial_report/report/trial_balance_xlsx.py +37 -38
  58. odoo/addons/account_financial_report/report/vat_report.py +36 -25
  59. odoo/addons/account_financial_report/report/vat_report_xlsx.py +1 -1
  60. odoo/addons/account_financial_report/security/ir.model.access.csv +2 -0
  61. odoo/addons/account_financial_report/security/security.xml +8 -0
  62. odoo/addons/account_financial_report/static/description/index.html +106 -55
  63. odoo/addons/account_financial_report/static/src/css/report.css +77 -42
  64. odoo/addons/account_financial_report/static/src/css/report_html.css +10 -0
  65. odoo/addons/account_financial_report/static/src/js/report.esm.js +72 -0
  66. odoo/addons/account_financial_report/static/src/js/report_action.esm.js +39 -0
  67. odoo/addons/account_financial_report/static/src/xml/report.xml +10 -9
  68. odoo/addons/account_financial_report/tests/__init__.py +1 -0
  69. odoo/addons/account_financial_report/tests/test_age_report_configuration.py +42 -0
  70. odoo/addons/account_financial_report/tests/test_aged_partner_balance.py +99 -9
  71. odoo/addons/account_financial_report/tests/test_general_ledger.py +19 -9
  72. odoo/addons/account_financial_report/tests/test_journal_ledger.py +18 -9
  73. odoo/addons/account_financial_report/tests/test_open_items.py +42 -2
  74. odoo/addons/account_financial_report/tests/test_trial_balance.py +114 -223
  75. odoo/addons/account_financial_report/tests/test_vat_report.py +17 -9
  76. odoo/addons/account_financial_report/view/account_age_report_configuration_views.xml +41 -0
  77. odoo/addons/account_financial_report/view/res_config_settings_views.xml +51 -0
  78. odoo/addons/account_financial_report/wizard/abstract_wizard.py +23 -0
  79. odoo/addons/account_financial_report/wizard/aged_partner_balance_wizard.py +22 -8
  80. odoo/addons/account_financial_report/wizard/aged_partner_balance_wizard_view.xml +2 -3
  81. odoo/addons/account_financial_report/wizard/general_ledger_wizard.py +42 -36
  82. odoo/addons/account_financial_report/wizard/general_ledger_wizard_view.xml +26 -41
  83. odoo/addons/account_financial_report/wizard/journal_ledger_wizard.py +19 -7
  84. odoo/addons/account_financial_report/wizard/journal_ledger_wizard_view.xml +15 -14
  85. odoo/addons/account_financial_report/wizard/open_items_wizard.py +34 -8
  86. odoo/addons/account_financial_report/wizard/open_items_wizard_view.xml +16 -14
  87. odoo/addons/account_financial_report/wizard/trial_balance_wizard.py +68 -45
  88. odoo/addons/account_financial_report/wizard/trial_balance_wizard_view.xml +40 -39
  89. odoo/addons/account_financial_report/wizard/vat_report_wizard.py +9 -3
  90. odoo/addons/account_financial_report/wizard/vat_report_wizard_view.xml +14 -14
  91. odoo_addon_account_financial_report-18.0.1.4.4.3.dist-info/METADATA +234 -0
  92. odoo_addon_account_financial_report-18.0.1.4.4.3.dist-info/RECORD +107 -0
  93. {odoo_addon_account_financial_report-15.0.1.1.0.1.dist-info → odoo_addon_account_financial_report-18.0.1.4.4.3.dist-info}/WHEEL +1 -1
  94. odoo_addon_account_financial_report-18.0.1.4.4.3.dist-info/top_level.txt +1 -0
  95. odoo/addons/account_financial_report/readme/CONTRIBUTORS.rst +0 -35
  96. odoo/addons/account_financial_report/readme/DESCRIPTION.rst +0 -16
  97. odoo/addons/account_financial_report/readme/HISTORY.rst +0 -19
  98. odoo/addons/account_financial_report/readme/ROADMAP.rst +0 -7
  99. odoo/addons/account_financial_report/static/src/js/action_manager_report.js +0 -37
  100. odoo/addons/account_financial_report/static/src/js/client_action.js +0 -58
  101. odoo/addons/account_financial_report/static/src/js/report.js +0 -58
  102. odoo_addon_account_financial_report-15.0.1.1.0.1.dist-info/METADATA +0 -179
  103. odoo_addon_account_financial_report-15.0.1.1.0.1.dist-info/RECORD +0 -95
  104. odoo_addon_account_financial_report-15.0.1.1.0.1.dist-info/top_level.txt +0 -1
@@ -1,7 +1,9 @@
1
1
  # Author: Julien Coux
2
2
  # Copyright 2016 Camptocamp SA
3
+ # Copyright 2024 Tecnativa - Carolina Fernandez
3
4
  # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
4
5
 
6
+ from odoo.fields import Date
5
7
  from odoo.tests import tagged
6
8
 
7
9
  from odoo.addons.account.tests.common import AccountTestInvoicingCommon
@@ -10,8 +12,26 @@ from odoo.addons.account.tests.common import AccountTestInvoicingCommon
10
12
  @tagged("post_install", "-at_install")
11
13
  class TestOpenItems(AccountTestInvoicingCommon):
12
14
  @classmethod
13
- def setUpClass(cls, chart_template_ref=None):
14
- super().setUpClass(chart_template_ref=chart_template_ref)
15
+ def setUpClass(cls):
16
+ super().setUpClass()
17
+ cls.env = cls.env(
18
+ context=dict(
19
+ cls.env.context,
20
+ mail_create_nolog=True,
21
+ mail_create_nosubscribe=True,
22
+ mail_notrack=True,
23
+ no_reset_password=True,
24
+ tracking_disable=True,
25
+ )
26
+ )
27
+ cls.account001 = cls.env["account.account"].create(
28
+ {
29
+ "code": "001",
30
+ "name": "Account 001",
31
+ "account_type": "income_other",
32
+ "reconcile": True,
33
+ }
34
+ )
15
35
 
16
36
  def test_partner_filter(self):
17
37
  partner_1 = self.env.ref("base.res_partner_1")
@@ -29,3 +49,23 @@ class TestOpenItems(AccountTestInvoicingCommon):
29
49
 
30
50
  wizard = self.env["open.items.report.wizard"].with_context(**context)
31
51
  self.assertEqual(wizard._default_partners(), expected_list)
52
+
53
+ def test_open_items_grouped_by(self):
54
+ open_item_wizard = self.env["open.items.report.wizard"]
55
+ all_accounts = self.env["account.account"].search(
56
+ [
57
+ ("reconcile", "=", True),
58
+ ],
59
+ order="code",
60
+ )
61
+ wizard = open_item_wizard.create(
62
+ {
63
+ "date_at": Date.today(),
64
+ "account_code_from": self.account001.id,
65
+ "account_code_to": all_accounts[-1].id,
66
+ "grouped_by": "salesperson",
67
+ }
68
+ )
69
+ wizard.on_change_account_range()
70
+ res = wizard._prepare_report_data()
71
+ self.assertEqual(res["grouped_by"], wizard.grouped_by)
@@ -3,6 +3,8 @@
3
3
  # Copyright 2020 ForgeFlow S.L. (https://www.forgeflow.com)
4
4
  # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
5
5
 
6
+ import re
7
+
6
8
  from odoo.tests import tagged
7
9
 
8
10
  from odoo.addons.account.tests.common import AccountTestInvoicingCommon
@@ -11,8 +13,18 @@ from odoo.addons.account.tests.common import AccountTestInvoicingCommon
11
13
  @tagged("post_install", "-at_install")
12
14
  class TestTrialBalanceReport(AccountTestInvoicingCommon):
13
15
  @classmethod
14
- def setUpClass(cls, chart_template_ref=None):
15
- super().setUpClass(chart_template_ref=chart_template_ref)
16
+ def setUpClass(cls):
17
+ super().setUpClass()
18
+ cls.env = cls.env(
19
+ context=dict(
20
+ cls.env.context,
21
+ mail_create_nolog=True,
22
+ mail_create_nosubscribe=True,
23
+ mail_notrack=True,
24
+ no_reset_password=True,
25
+ tracking_disable=True,
26
+ )
27
+ )
16
28
  # Remove previous account groups and related invoices to avoid conflicts
17
29
  group_obj = cls.env["account.group"]
18
30
  cls.group1 = group_obj.create({"code_prefix_start": "1", "name": "Group 1"})
@@ -21,14 +33,21 @@ class TestTrialBalanceReport(AccountTestInvoicingCommon):
21
33
  )
22
34
  cls.group2 = group_obj.create({"code_prefix_start": "2", "name": "Group 2"})
23
35
  # Set accounts
36
+ cls.account001 = cls._create_account_account(
37
+ cls,
38
+ {
39
+ "code": "001",
40
+ "name": "Account 001",
41
+ "account_type": "income_other",
42
+ },
43
+ )
24
44
  cls.account100 = cls.company_data["default_account_receivable"]
25
- cls.account100.group_id = cls.group1.id
26
45
  cls.account110 = cls.env["account.account"].search(
27
46
  [
28
47
  (
29
- "user_type_id",
48
+ "account_type",
30
49
  "=",
31
- cls.env.ref("account.data_unaffected_earnings").id,
50
+ "equity_unaffected",
32
51
  ),
33
52
  ],
34
53
  limit=1,
@@ -38,10 +57,7 @@ class TestTrialBalanceReport(AccountTestInvoicingCommon):
38
57
  {
39
58
  "code": "200",
40
59
  "name": "Account 200",
41
- "group_id": cls.group2.id,
42
- "user_type_id": cls.env.ref(
43
- "account.data_account_type_other_income"
44
- ).id,
60
+ "account_type": "income_other",
45
61
  },
46
62
  )
47
63
  cls.account300 = cls._create_account_account(
@@ -49,20 +65,15 @@ class TestTrialBalanceReport(AccountTestInvoicingCommon):
49
65
  {
50
66
  "code": "300",
51
67
  "name": "Account 300",
52
- "user_type_id": cls.env.ref(
53
- "account.data_account_type_other_income"
54
- ).id,
68
+ "account_type": "income_other",
55
69
  },
56
70
  )
57
- cls.account301 = cls._create_account_account(
71
+ cls.account201 = cls._create_account_account(
58
72
  cls,
59
73
  {
60
- "code": "301",
61
- "name": "Account 301",
62
- "group_id": cls.group2.id,
63
- "user_type_id": cls.env.ref(
64
- "account.data_account_type_other_income"
65
- ).id,
74
+ "code": "201",
75
+ "name": "Account 201",
76
+ "account_type": "income_other",
66
77
  },
67
78
  )
68
79
  cls.previous_fy_date_start = "2015-01-01"
@@ -75,9 +86,9 @@ class TestTrialBalanceReport(AccountTestInvoicingCommon):
75
86
  cls.unaffected_account = cls.env["account.account"].search(
76
87
  [
77
88
  (
78
- "user_type_id",
89
+ "account_type",
79
90
  "=",
80
- cls.env.ref("account.data_unaffected_earnings").id,
91
+ "equity_unaffected",
81
92
  ),
82
93
  ],
83
94
  limit=1,
@@ -85,8 +96,6 @@ class TestTrialBalanceReport(AccountTestInvoicingCommon):
85
96
 
86
97
  def _create_account_account(self, vals):
87
98
  item = self.env["account.account"].create(vals)
88
- if "group_id" in vals:
89
- item.group_id = vals["group_id"]
90
99
  return item
91
100
 
92
101
  def _add_move(
@@ -154,7 +163,7 @@ class TestTrialBalanceReport(AccountTestInvoicingCommon):
154
163
  "debit": receivable_credit,
155
164
  "credit": receivable_debit,
156
165
  "partner_id": partner.id,
157
- "account_id": self.account301.id,
166
+ "account_id": self.account201.id,
158
167
  },
159
168
  ),
160
169
  ],
@@ -163,7 +172,7 @@ class TestTrialBalanceReport(AccountTestInvoicingCommon):
163
172
  move.action_post()
164
173
 
165
174
  def _get_report_lines(
166
- self, with_partners=False, account_ids=False, hierarchy_on="computed"
175
+ self, with_partners=False, account_ids=False, show_hierarchy=False
167
176
  ):
168
177
  company = self.env.user.company_id
169
178
  trial_balance = self.env["trial.balance.report.wizard"].create(
@@ -172,14 +181,14 @@ class TestTrialBalanceReport(AccountTestInvoicingCommon):
172
181
  "date_to": self.date_end,
173
182
  "target_move": "posted",
174
183
  "hide_account_at_0": True,
175
- "hierarchy_on": hierarchy_on,
184
+ "show_hierarchy": show_hierarchy,
176
185
  "company_id": company.id,
177
186
  "account_ids": account_ids,
178
187
  "fy_start_date": self.fy_date_start,
179
188
  "show_partner_details": with_partners,
180
189
  }
181
190
  )
182
- data = trial_balance._prepare_report_trial_balance()
191
+ data = trial_balance._prepare_report_data()
183
192
  res_data = self.env[
184
193
  "report.account_financial_report.trial_balance"
185
194
  ]._get_report_values(trial_balance, data)
@@ -248,195 +257,9 @@ class TestTrialBalanceReport(AccountTestInvoicingCommon):
248
257
  self.assertTrue(self.account100 in self.group1.compute_account_ids)
249
258
  self.assertTrue(self.account200 in self.group2.compute_account_ids)
250
259
 
251
- def test_01_account_balance_computed(self):
252
- # Change code of the P&L for not being automatically included
253
- # in group 1 balances
254
- earning_accs = self.env["account.account"].search(
255
- [
256
- (
257
- "user_type_id",
258
- "=",
259
- self.env.ref("account.data_unaffected_earnings").id,
260
- ),
261
- ("company_id", "=", self.env.user.company_id.id),
262
- ]
263
- )
264
- for acc in earning_accs:
265
- acc.code = "999" + acc.code
266
- # Generate the general ledger line
267
- res_data = self._get_report_lines()
268
- trial_balance = res_data["trial_balance"]
269
-
270
- check_receivable_account = self.check_account_in_report(
271
- self.account100.id, trial_balance
272
- )
273
- self.assertFalse(check_receivable_account)
274
- check_income_account = self.check_account_in_report(
275
- self.account200.id, trial_balance
276
- )
277
- self.assertFalse(check_income_account)
278
- self.assertTrue(
279
- self.check_account_in_report(self.unaffected_account.id, trial_balance)
280
- )
281
-
282
- # Add a move at the previous day of the first day of fiscal year
283
- # to check the initial balance
284
- self._add_move(
285
- date=self.previous_fy_date_end,
286
- receivable_debit=1000,
287
- receivable_credit=0,
288
- income_debit=0,
289
- income_credit=1000,
290
- )
291
-
292
- # Re Generate the trial balance line
293
- res_data = self._get_report_lines()
294
- trial_balance = res_data["trial_balance"]
295
- check_receivable_account = self.check_account_in_report(
296
- self.account100.id, trial_balance
297
- )
298
- self.assertTrue(check_receivable_account)
299
- check_income_account = self.check_account_in_report(
300
- self.account200.id, trial_balance
301
- )
302
- self.assertFalse(check_income_account)
303
-
304
- # Check the initial and final balance
305
- account_receivable_lines = self._get_account_lines(
306
- self.account100.id, trial_balance
307
- )
308
- group1_lines = self._get_group_lines(self.group1.id, trial_balance)
309
-
310
- self.assertEqual(account_receivable_lines["initial_balance"], 1000)
311
- self.assertEqual(account_receivable_lines["debit"], 0)
312
- self.assertEqual(account_receivable_lines["credit"], 0)
313
- self.assertEqual(account_receivable_lines["final_balance"], 1000)
314
-
315
- self.assertEqual(group1_lines["initial_balance"], 1000)
316
- self.assertEqual(group1_lines["debit"], 0)
317
- self.assertEqual(group1_lines["credit"], 0)
318
- self.assertEqual(group1_lines["final_balance"], 1000)
319
-
320
- # Add reversed move of the initial move the first day of fiscal year
321
- # to check the first day of fiscal year is not used
322
- # to compute the initial balance
323
- self._add_move(
324
- date=self.fy_date_start,
325
- receivable_debit=0,
326
- receivable_credit=1000,
327
- income_debit=1000,
328
- income_credit=0,
329
- )
330
-
331
- # Re Generate the trial balance line
332
- res_data = self._get_report_lines()
333
- trial_balance = res_data["trial_balance"]
334
- check_receivable_account = self.check_account_in_report(
335
- self.account100.id, trial_balance
336
- )
337
- self.assertTrue(check_receivable_account)
338
- check_income_account = self.check_account_in_report(
339
- self.account200.id, trial_balance
340
- )
341
- self.assertTrue(check_income_account)
342
-
343
- # Re Generate the trial balance line with an account filter
344
- res_data = self._get_report_lines(
345
- account_ids=(self.account100 + self.account200).ids
346
- )
347
- trial_balance = res_data["trial_balance"]
348
- self.assertTrue(self.check_account_in_report(self.account100.id, trial_balance))
349
- self.assertTrue(self.check_account_in_report(self.account200.id, trial_balance))
350
- # Unaffected account should not be present
351
- self.assertFalse(
352
- self.check_account_in_report(self.unaffected_account.id, trial_balance)
353
- )
354
-
355
- # Check the initial and final balance
356
- account_receivable_lines = self._get_account_lines(
357
- self.account100.id, trial_balance
358
- )
359
- account_income_lines = self._get_account_lines(
360
- self.account200.id, trial_balance
361
- )
362
- group1_lines = self._get_group_lines(self.group1.id, trial_balance)
363
- group2_lines = self._get_group_lines(self.group2.id, trial_balance)
364
-
365
- self.assertEqual(account_receivable_lines["initial_balance"], 1000)
366
- self.assertEqual(account_receivable_lines["debit"], 0)
367
- self.assertEqual(account_receivable_lines["credit"], 1000)
368
- self.assertEqual(account_receivable_lines["final_balance"], 0)
369
-
370
- self.assertEqual(account_income_lines["initial_balance"], 0)
371
- self.assertEqual(account_income_lines["debit"], 1000)
372
- self.assertEqual(account_income_lines["credit"], 0)
373
- self.assertEqual(account_income_lines["final_balance"], 1000)
374
-
375
- self.assertEqual(group1_lines["initial_balance"], 1000)
376
- self.assertEqual(group1_lines["debit"], 0)
377
- self.assertEqual(group1_lines["credit"], 1000)
378
- self.assertEqual(group1_lines["final_balance"], 0)
379
-
380
- self.assertEqual(group2_lines["initial_balance"], 0)
381
- self.assertEqual(group2_lines["debit"], 1000)
382
- self.assertEqual(group2_lines["credit"], 0)
383
- self.assertEqual(group2_lines["final_balance"], 1000)
384
-
385
- # Add another move at the end day of fiscal year
386
- # to check that it correctly used on report
387
- self._add_move(
388
- date=self.fy_date_end,
389
- receivable_debit=0,
390
- receivable_credit=1000,
391
- income_debit=1000,
392
- income_credit=0,
393
- )
394
-
395
- # Re Generate the trial balance line
396
- res_data = self._get_report_lines()
397
- trial_balance = res_data["trial_balance"]
398
- check_receivable_account = self.check_account_in_report(
399
- self.account100.id, trial_balance
400
- )
401
- self.assertTrue(check_receivable_account)
402
- check_income_account = self.check_account_in_report(
403
- self.account200.id, trial_balance
404
- )
405
- self.assertTrue(check_income_account)
406
-
407
- # Check the initial and final balance
408
- account_receivable_lines = self._get_account_lines(
409
- self.account100.id, trial_balance
410
- )
411
- account_income_lines = self._get_account_lines(
412
- self.account200.id, trial_balance
413
- )
414
- group1_lines = self._get_group_lines(self.group1.id, trial_balance)
415
- group2_lines = self._get_group_lines(self.group2.id, trial_balance)
416
-
417
- self.assertEqual(account_receivable_lines["initial_balance"], 1000)
418
- self.assertEqual(account_receivable_lines["debit"], 0)
419
- self.assertEqual(account_receivable_lines["credit"], 2000)
420
- self.assertEqual(account_receivable_lines["final_balance"], -1000)
421
-
422
- self.assertEqual(account_income_lines["initial_balance"], 0)
423
- self.assertEqual(account_income_lines["debit"], 2000)
424
- self.assertEqual(account_income_lines["credit"], 0)
425
- self.assertEqual(account_income_lines["final_balance"], 2000)
426
-
427
- self.assertEqual(group1_lines["initial_balance"], 1000)
428
- self.assertEqual(group1_lines["debit"], 0)
429
- self.assertEqual(group1_lines["credit"], 2000)
430
- self.assertEqual(group1_lines["final_balance"], -1000)
431
-
432
- self.assertEqual(group2_lines["initial_balance"], 0)
433
- self.assertEqual(group2_lines["debit"], 2000)
434
- self.assertEqual(group2_lines["credit"], 0)
435
- self.assertEqual(group2_lines["final_balance"], 2000)
436
-
437
260
  def test_02_account_balance_hierarchy(self):
438
261
  # Generate the general ledger line
439
- res_data = self._get_report_lines(hierarchy_on="relation")
262
+ res_data = self._get_report_lines(show_hierarchy=True)
440
263
  trial_balance = res_data["trial_balance"]
441
264
  check_receivable_account = self.check_account_in_report(
442
265
  self.account100.id, trial_balance
@@ -458,7 +281,7 @@ class TestTrialBalanceReport(AccountTestInvoicingCommon):
458
281
  )
459
282
 
460
283
  # Re Generate the trial balance line
461
- res_data = self._get_report_lines(hierarchy_on="relation")
284
+ res_data = self._get_report_lines(show_hierarchy=True)
462
285
  trial_balance = res_data["trial_balance"]
463
286
  check_receivable_account = self.check_account_in_report(
464
287
  self.account100.id, trial_balance
@@ -497,7 +320,7 @@ class TestTrialBalanceReport(AccountTestInvoicingCommon):
497
320
  )
498
321
 
499
322
  # Re Generate the trial balance line
500
- res_data = self._get_report_lines(hierarchy_on="relation")
323
+ res_data = self._get_report_lines(show_hierarchy=True)
501
324
  trial_balance = res_data["trial_balance"]
502
325
  check_receivable_account = self.check_account_in_report(
503
326
  self.account100.id, trial_balance
@@ -549,7 +372,7 @@ class TestTrialBalanceReport(AccountTestInvoicingCommon):
549
372
  )
550
373
 
551
374
  # Re Generate the trial balance line
552
- res_data = self._get_report_lines(hierarchy_on="relation")
375
+ res_data = self._get_report_lines(show_hierarchy=True)
553
376
  trial_balance = res_data["trial_balance"]
554
377
  check_receivable_account = self.check_account_in_report(
555
378
  self.account100.id, trial_balance
@@ -715,12 +538,12 @@ class TestTrialBalanceReport(AccountTestInvoicingCommon):
715
538
  "date_to": self.date_end,
716
539
  "target_move": "posted",
717
540
  "hide_account_at_0": False,
718
- "hierarchy_on": "none",
541
+ "show_hierarchy": False,
719
542
  "company_id": company.id,
720
543
  "fy_start_date": self.fy_date_start,
721
544
  }
722
545
  )
723
- data = trial_balance._prepare_report_trial_balance()
546
+ data = trial_balance._prepare_report_data()
724
547
  res_data = self.env[
725
548
  "report.account_financial_report.trial_balance"
726
549
  ]._get_report_values(trial_balance, data)
@@ -768,12 +591,12 @@ class TestTrialBalanceReport(AccountTestInvoicingCommon):
768
591
  "date_to": self.date_end,
769
592
  "target_move": "posted",
770
593
  "hide_account_at_0": False,
771
- "hierarchy_on": "none",
594
+ "show_hierarchy": False,
772
595
  "company_id": company.id,
773
596
  "fy_start_date": self.fy_date_start,
774
597
  }
775
598
  )
776
- data = trial_balance._prepare_report_trial_balance()
599
+ data = trial_balance._prepare_report_data()
777
600
  res_data = self.env[
778
601
  "report.account_financial_report.trial_balance"
779
602
  ]._get_report_values(trial_balance, data)
@@ -822,12 +645,12 @@ class TestTrialBalanceReport(AccountTestInvoicingCommon):
822
645
  "date_to": self.date_end,
823
646
  "target_move": "posted",
824
647
  "hide_account_at_0": False,
825
- "hierarchy_on": "none",
648
+ "show_hierarchy": False,
826
649
  "company_id": company.id,
827
650
  "fy_start_date": self.fy_date_start,
828
651
  }
829
652
  )
830
- data = trial_balance._prepare_report_trial_balance()
653
+ data = trial_balance._prepare_report_data()
831
654
  res_data = self.env[
832
655
  "report.account_financial_report.trial_balance"
833
656
  ]._get_report_values(trial_balance, data)
@@ -857,3 +680,71 @@ class TestTrialBalanceReport(AccountTestInvoicingCommon):
857
680
  self.assertEqual(total_initial_balance, 0)
858
681
  self.assertEqual(total_final_balance, 0)
859
682
  self.assertEqual(total_debit, total_credit)
683
+
684
+ def test_05_all_accounts_loaded(self):
685
+ # Tests if all accounts which code is number are loaded
686
+ # when the account_code_ fields changed
687
+ all_accounts = (
688
+ self.env["account.account"]
689
+ .search([], order="code")
690
+ .filtered(lambda acc: re.fullmatch(r"[0-9]+(\.[0-9]+)?", acc.code))
691
+ )
692
+ company = self.env.user.company_id
693
+ trial_balance = self.env["trial.balance.report.wizard"].create(
694
+ {
695
+ "date_from": self.date_start,
696
+ "date_to": self.date_end,
697
+ "target_move": "posted",
698
+ "hide_account_at_0": False,
699
+ "show_hierarchy": False,
700
+ "company_id": company.id,
701
+ "fy_start_date": self.fy_date_start,
702
+ "account_code_from": self.account001.id,
703
+ "account_code_to": all_accounts[-1].id,
704
+ }
705
+ )
706
+ trial_balance.on_change_account_range()
707
+ # sets are needed because some codes are duplicated and
708
+ # thus the length of all_accounts would be higher
709
+ all_accounts_code_set = set()
710
+ trial_balance_code_set = set()
711
+ [all_accounts_code_set.add(account.code) for account in all_accounts]
712
+ [
713
+ trial_balance_code_set.add(account.code)
714
+ for account in trial_balance.account_ids
715
+ ]
716
+ self.assertEqual(len(trial_balance_code_set), len(all_accounts_code_set))
717
+ self.assertTrue(trial_balance_code_set == all_accounts_code_set)
718
+
719
+ def test_06_all_accounts_loaded_newid(self):
720
+ all_accounts = (
721
+ self.env["account.account"]
722
+ .search([], order="code")
723
+ .filtered(lambda acc: re.fullmatch(r"[0-9]+(\.[0-9]+)?", acc.code))
724
+ )
725
+ company = self.env.user.company_id
726
+ trial_balance = self.env["trial.balance.report.wizard"].new(
727
+ {
728
+ "date_from": self.date_start,
729
+ "date_to": self.date_end,
730
+ "target_move": "posted",
731
+ "hide_account_at_0": False,
732
+ "show_hierarchy": False,
733
+ "company_id": company.id,
734
+ "fy_start_date": self.fy_date_start,
735
+ "account_code_from": self.account001.id,
736
+ "account_code_to": all_accounts[-1].id,
737
+ }
738
+ )
739
+ trial_balance.on_change_account_range()
740
+ # sets are needed because some codes are duplicated and
741
+ # thus the length of all_accounts would be higher
742
+ all_accounts_code_set = set()
743
+ trial_balance_code_set = set()
744
+ [all_accounts_code_set.add(account.code) for account in all_accounts]
745
+ [
746
+ trial_balance_code_set.add(account.code)
747
+ for account in trial_balance.account_ids
748
+ ]
749
+ self.assertEqual(len(trial_balance_code_set), len(all_accounts_code_set))
750
+ self.assertTrue(trial_balance_code_set == all_accounts_code_set)
@@ -6,8 +6,7 @@ import time
6
6
  from datetime import date
7
7
 
8
8
  from odoo import fields
9
- from odoo.tests import tagged
10
- from odoo.tests.common import Form
9
+ from odoo.tests import Form, tagged
11
10
 
12
11
  from odoo.addons.account.tests.common import AccountTestInvoicingCommon
13
12
 
@@ -30,7 +29,6 @@ class TestVATReport(AccountTestInvoicingCommon):
30
29
  )
31
30
  move_form.invoice_date = invoice_date or fields.Date.from_string("2019-01-01")
32
31
  move_form.partner_id = partner or cls.partner_a
33
- move_form.name = name or "Test"
34
32
  lines = lines or []
35
33
  for line in lines:
36
34
  with move_form.invoice_line_ids.new() as line_form:
@@ -48,8 +46,18 @@ class TestVATReport(AccountTestInvoicingCommon):
48
46
  return rslt
49
47
 
50
48
  @classmethod
51
- def setUpClass(cls, chart_template_ref=None):
52
- super().setUpClass(chart_template_ref=chart_template_ref)
49
+ def setUpClass(cls):
50
+ super().setUpClass()
51
+ cls.env = cls.env(
52
+ context=dict(
53
+ cls.env.context,
54
+ mail_create_nolog=True,
55
+ mail_create_nosubscribe=True,
56
+ mail_notrack=True,
57
+ no_reset_password=True,
58
+ tracking_disable=True,
59
+ )
60
+ )
53
61
  cls.date_from = time.strftime("%Y-%m-01")
54
62
  cls.date_to = time.strftime("%Y-%m-28")
55
63
  cls.company = cls.env.user.company_id
@@ -59,11 +67,11 @@ class TestVATReport(AccountTestInvoicingCommon):
59
67
  cls.expense_account = cls.company_data["default_account_expense"]
60
68
  cls.tax_account = cls.env["account.account"].search(
61
69
  [
62
- ("company_id", "=", cls.company.id),
70
+ ("company_ids", "in", [cls.company.id]),
63
71
  (
64
- "user_type_id",
72
+ "account_type",
65
73
  "=",
66
- cls.env.ref("account.data_account_type_non_current_liabilities").id,
74
+ "liability_non_current",
67
75
  ),
68
76
  ],
69
77
  limit=1,
@@ -209,7 +217,7 @@ class TestVATReport(AccountTestInvoicingCommon):
209
217
  "tax_detail": True,
210
218
  }
211
219
  )
212
- data = vat_report._prepare_vat_report()
220
+ data = vat_report._prepare_report_data()
213
221
  res_data = self.env[
214
222
  "report.account_financial_report.vat_report"
215
223
  ]._get_report_values(vat_report, data)
@@ -0,0 +1,41 @@
1
+ <?xml version="1.0" encoding="utf-8" ?>
2
+ <!-- Copyright 2023 Ernesto Garcia <ernesto.garcia@tecnativa.com>
3
+ Copyright 2023 Carolina Fernandez <carolina.fernandez@tecnativa.com>
4
+ License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
5
+ <odoo>
6
+ <record id="aged_partner_report_configuration_form" model="ir.ui.view">
7
+ <field name="name">Age partner report configuration form</field>
8
+ <field name="model">account.age.report.configuration</field>
9
+ <field name="arch" type="xml">
10
+ <form>
11
+ <sheet>
12
+ <group>
13
+ <field name="name" />
14
+ <field name="company_id" />
15
+ </group>
16
+ <field name="line_ids">
17
+ <list editable="bottom">
18
+ <field name="name" />
19
+ <field name="inferior_limit" />
20
+ </list>
21
+ </field>
22
+ </sheet>
23
+ </form>
24
+ </field>
25
+ </record>
26
+ <record id="aged_partner_report_configuration_tree" model="ir.ui.view">
27
+ <field name="name">Age partner report configuration list</field>
28
+ <field name="model">account.age.report.configuration</field>
29
+ <field name="arch" type="xml">
30
+ <list>
31
+ <field name="name" />
32
+ <field name="company_id" />
33
+ </list>
34
+ </field>
35
+ </record>
36
+ <record id="action_aged_partner_report_configuration" model="ir.actions.act_window">
37
+ <field name="name">Age Partner Report Configuration</field>
38
+ <field name="res_model">account.age.report.configuration</field>
39
+ <field name="view_mode">list,form</field>
40
+ </record>
41
+ </odoo>