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,101 +1,137 @@
1
+ a {
2
+ color: #00337b;
3
+ }
4
+
1
5
  .act_as_table {
2
6
  display: table !important;
3
7
  background-color: white;
4
8
  }
9
+
5
10
  .act_as_row {
6
11
  display: table-row !important;
7
12
  page-break-inside: avoid;
8
13
  }
14
+
9
15
  .act_as_cell {
10
16
  display: table-cell !important;
11
17
  page-break-inside: avoid;
12
18
  }
19
+
13
20
  .act_as_thead {
14
21
  display: table-header-group !important;
15
22
  }
23
+
16
24
  .act_as_tbody {
17
25
  display: table-row-group !important;
18
26
  }
27
+
19
28
  .list_table,
20
29
  .data_table,
21
30
  .totals_table {
22
31
  width: 100% !important;
23
32
  }
33
+
24
34
  .act_as_row.labels {
25
35
  background-color: #f0f0f0 !important;
26
36
  }
37
+
27
38
  .list_table,
28
39
  .data_table,
29
40
  .totals_table,
30
41
  .list_table .act_as_row {
31
- border-left: 0px;
32
- border-right: 0px;
42
+ border-left: 0;
43
+ border-right: 0;
33
44
  text-align: center;
34
45
  font-size: 10px;
35
- padding-right: 3px;
36
- padding-left: 3px;
37
- padding-top: 2px;
38
- padding-bottom: 2px;
46
+ padding: 2px 3px;
39
47
  border-collapse: collapse;
40
48
  }
49
+
41
50
  .totals_table {
42
51
  font-weight: bold;
43
52
  text-align: center;
44
53
  }
45
- .list_table .act_as_row.labels,
46
- .list_table .act_as_row.initial_balance,
47
- .list_table .act_as_row.lines {
48
- border-color: grey !important;
49
- border-bottom: 1px solid lightGrey !important;
54
+
55
+ .list_table {
56
+ .act_as_row {
57
+ &.labels,
58
+ &.initial_balance,
59
+ &.lines {
60
+ border-color: grey !important;
61
+ border-bottom: 1px solid lightGrey !important;
62
+ }
63
+ }
50
64
  }
51
- .data_table .act_as_cell {
52
- border: 1px solid lightGrey;
53
- text-align: center;
65
+
66
+ .data_table {
67
+ .act_as_cell {
68
+ border: 1px solid lightGrey;
69
+ text-align: center;
70
+ word-wrap: break-word;
71
+ }
72
+
73
+ .act_as_row.labels {
74
+ font-weight: bold;
75
+ }
54
76
  }
55
- .data_table .act_as_cell,
56
- .list_table .act_as_cell,
57
- .totals_table .act_as_cell {
58
- word-wrap: break-word;
77
+
78
+ .totals_table {
79
+ .act_as_cell {
80
+ word-wrap: break-word;
81
+ }
82
+
83
+ .act_as_row.labels {
84
+ font-weight: bold;
85
+ }
59
86
  }
60
- .data_table .act_as_row.labels,
61
- .totals_table .act_as_row.labels {
62
- font-weight: bold;
87
+
88
+ .list_table .act_as_cell {
89
+ &.first_column {
90
+ padding-left: 0;
91
+ /* border-left:1px solid lightGrey; uncomment to active column lines */
92
+ }
93
+
94
+ /* border-right:1px solid lightGrey; uncomment to active column lines */
63
95
  }
96
+
64
97
  .initial_balance .act_as_cell {
65
98
  font-style: italic;
66
99
  }
100
+
67
101
  .account_title {
68
102
  font-size: 11px;
69
103
  font-weight: bold;
104
+
105
+ &.labels {
106
+ background-color: #f0f0f0 !important;
107
+ }
70
108
  }
71
- .account_title.labels {
72
- background-color: #f0f0f0 !important;
73
- }
74
- .act_as_cell.amount {
75
- word-wrap: normal;
76
- text-align: right;
77
- }
78
- .act_as_cell.left {
79
- text-align: left;
80
- }
81
- .act_as_cell.right {
82
- text-align: right;
83
- }
84
- /*.list_table .act_as_cell {*/
85
- /* border-right:1px solid lightGrey; uncomment to active column lines */
86
- /*}*/
87
- .list_table .act_as_cell.first_column {
88
- padding-left: 0px;
89
- /* border-left:1px solid lightGrey; uncomment to active column lines */
109
+
110
+ .act_as_cell {
111
+ &.amount {
112
+ word-wrap: normal;
113
+ text-align: right;
114
+ }
115
+
116
+ &.left {
117
+ text-align: left;
118
+ }
119
+
120
+ &.right {
121
+ text-align: right;
122
+ }
90
123
  }
124
+
91
125
  .overflow_ellipsis {
92
126
  text-overflow: ellipsis;
93
127
  overflow: hidden;
94
128
  white-space: nowrap;
95
129
  }
130
+
96
131
  .custom_footer {
97
132
  font-size: 7px !important;
98
133
  }
134
+
99
135
  .page_break {
100
136
  page-break-inside: avoid;
101
137
  }
@@ -107,7 +143,6 @@
107
143
  .o_account_financial_reports_page {
108
144
  padding-top: 10px;
109
145
  width: 90%;
110
- margin-right: auto;
111
- margin-left: auto;
146
+ margin: 0 auto;
112
147
  font-family: Helvetica, Arial;
113
148
  }
@@ -0,0 +1,10 @@
1
+ // Styles of HTML report
2
+ .account_title {
3
+ span {
4
+ font-size: 1rem !important;
5
+ }
6
+ }
7
+
8
+ .act_as_cell {
9
+ font-size: 0.9rem !important;
10
+ }
@@ -0,0 +1,72 @@
1
+ import {useComponent, useEffect} from "@odoo/owl";
2
+
3
+ function toTitleCase(str) {
4
+ return str
5
+ .replaceAll(".", " ")
6
+ .replace(
7
+ /\w\S*/g,
8
+ (txt) => `${txt.charAt(0).toUpperCase()}${txt.substr(1).toLowerCase()}`
9
+ );
10
+ }
11
+
12
+ function enrich(component, targetElement, selector, isIFrame = false) {
13
+ // eslint-disable-next-line no-undef
14
+ let doc = window.document;
15
+ let contentDocument = targetElement;
16
+
17
+ // If we are in an iframe, we need to take the right document
18
+ // both for the element and the doc
19
+ if (isIFrame) {
20
+ contentDocument = targetElement.contentDocument;
21
+ doc = contentDocument;
22
+ }
23
+
24
+ // If there are selector, we may have multiple blocks of code to enrich
25
+ const targets = [];
26
+ if (selector) {
27
+ targets.push(...contentDocument.querySelectorAll(selector));
28
+ } else {
29
+ targets.push(contentDocument);
30
+ }
31
+
32
+ // Search the elements with the selector, update them and bind an action.
33
+ for (const currentTarget of targets) {
34
+ const elementsToWrap = currentTarget.querySelectorAll("[res-model][domain]");
35
+ for (const element of elementsToWrap.values()) {
36
+ const wrapper = doc.createElement("a");
37
+ wrapper.setAttribute("href", "#");
38
+ wrapper.addEventListener("click", (ev) => {
39
+ ev.preventDefault();
40
+ component.env.services.action.doAction({
41
+ type: "ir.actions.act_window",
42
+ res_model: element.getAttribute("res-model"),
43
+ domain: element.getAttribute("domain"),
44
+ name: toTitleCase(element.getAttribute("res-model")),
45
+ views: [
46
+ [false, "list"],
47
+ [false, "form"],
48
+ ],
49
+ });
50
+ });
51
+ element.parentNode.insertBefore(wrapper, element);
52
+ wrapper.appendChild(element);
53
+ }
54
+ }
55
+ }
56
+
57
+ export function useEnrichWithActionLinks(ref, selector = null) {
58
+ const comp = useComponent();
59
+ useEffect(
60
+ (element) => {
61
+ // If we get an iframe, we need to wait until everything is loaded
62
+ if (element.matches("iframe")) {
63
+ element.addEventListener("load", () =>
64
+ enrich(comp, element, selector, true)
65
+ );
66
+ } else {
67
+ enrich(comp, element, selector);
68
+ }
69
+ },
70
+ () => [ref.el]
71
+ );
72
+ }
@@ -0,0 +1,39 @@
1
+ import {ReportAction} from "@web/webclient/actions/reports/report_action";
2
+ import {patch} from "@web/core/utils/patch";
3
+ import {useEnrichWithActionLinks} from "./report.esm";
4
+
5
+ const MODULE_NAME = "account_financial_report";
6
+
7
+ patch(ReportAction.prototype, {
8
+ setup() {
9
+ super.setup(...arguments);
10
+ this.isAccountFinancialReport = this.props.report_name.startsWith(
11
+ `${MODULE_NAME}.`
12
+ );
13
+ useEnrichWithActionLinks(this.iframe);
14
+ },
15
+
16
+ export() {
17
+ this.action.doAction({
18
+ type: "ir.actions.report",
19
+ report_type: "xlsx",
20
+ report_name: this._get_xlsx_name(this.props.report_name),
21
+ report_file: this._get_xlsx_name(this.props.report_file),
22
+ data: this.props.data || {},
23
+ context: this.props.context || {},
24
+ display_name: this.title,
25
+ });
26
+ },
27
+
28
+ /**
29
+ * @param {String} str
30
+ * @returns {String}
31
+ */
32
+ _get_xlsx_name(str) {
33
+ if (typeof str !== "string") {
34
+ return str;
35
+ }
36
+ const parts = str.split(".");
37
+ return `a_f_r.report_${parts[parts.length - 1]}_xlsx`;
38
+ },
39
+ });
@@ -1,17 +1,18 @@
1
1
  <template>
2
2
  <!-- Buttons of the Control Panel -->
3
- <t t-name="account_financial_report.client_action.ControlButtons">
4
- <div class="o_report_buttons">
3
+ <t
4
+ t-name="info.ReportAction"
5
+ t-inherit="web.ReportAction"
6
+ t-inherit-mode="extension"
7
+ >
8
+ <xpath expr="//button" position="after">
5
9
  <button
10
+ t-if="isAccountFinancialReport"
11
+ t-on-click="export"
6
12
  type="button"
7
- class="btn btn-primary o_report_print"
8
- title="Print"
9
- >Print</button>
10
- <button
11
- type="button"
12
- class="btn btn-secondary o_report_export"
13
+ class="btn btn-secondary"
13
14
  title="Export"
14
15
  >Export</button>
15
- </div>
16
+ </xpath>
16
17
  </t>
17
18
  </template>
@@ -7,3 +7,4 @@ from . import test_journal_ledger
7
7
  from . import test_open_items
8
8
  from . import test_trial_balance
9
9
  from . import test_vat_report
10
+ from . import test_age_report_configuration
@@ -0,0 +1,42 @@
1
+ # Copyright 2023 Tecnativa - Carolina Fernandez
2
+ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
3
+
4
+ from odoo.exceptions import ValidationError
5
+ from odoo.tests import common, tagged
6
+
7
+
8
+ @tagged("post_install", "-at_install")
9
+ class TestAccountAgeReportConfiguration(common.TransactionCase):
10
+ @classmethod
11
+ def setUpClass(cls):
12
+ super().setUpClass()
13
+ cls.account_age_report_config = cls.env[
14
+ "account.age.report.configuration"
15
+ ].create(
16
+ {
17
+ "name": "Intervals configuration",
18
+ "line_ids": [
19
+ (
20
+ 0,
21
+ 0,
22
+ {
23
+ "name": "1-30",
24
+ "inferior_limit": 30,
25
+ },
26
+ ),
27
+ ],
28
+ }
29
+ )
30
+
31
+ def test_check_line_ids_constraint(self):
32
+ with self.assertRaises(ValidationError):
33
+ self.env["account.age.report.configuration"].create(
34
+ {"name": "Interval configuration", "line_ids": False}
35
+ )
36
+
37
+ def test_check_lower_inferior_limit_constraint(self):
38
+ with self.assertRaises(ValidationError):
39
+ self.account_age_report_config.line_ids.inferior_limit = 0
40
+
41
+ with self.assertRaises(ValidationError):
42
+ self.account_age_report_config.line_ids.inferior_limit = -1
@@ -1,25 +1,97 @@
1
1
  # Copyright 2021 Simone Rubino - Agile Business Group
2
2
  # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
3
3
 
4
- from odoo.tests import TransactionCase
4
+ from odoo.tests import TransactionCase, tagged
5
5
  from odoo.tools import DEFAULT_SERVER_DATE_FORMAT, test_reports
6
6
 
7
7
 
8
+ @tagged("post_install", "-at_install")
8
9
  class TestAgedPartnerBalance(TransactionCase):
9
- def setUp(self):
10
- super().setUp()
11
- self.wizard_model = self.env["aged.partner.balance.report.wizard"]
12
-
13
- def test_report(self):
14
- """Check that report is produced correctly."""
15
- wizard = self.wizard_model.create(
10
+ @classmethod
11
+ def setUpClass(cls):
12
+ super().setUpClass()
13
+ cls.env = cls.env(
14
+ context=dict(
15
+ cls.env.context,
16
+ mail_create_nolog=True,
17
+ mail_create_nosubscribe=True,
18
+ mail_notrack=True,
19
+ no_reset_password=True,
20
+ tracking_disable=True,
21
+ )
22
+ )
23
+ cls.wizard_model = cls.env["aged.partner.balance.report.wizard"]
24
+ # Check that report is produced correctly
25
+ cls.wizard_with_line_details = cls.wizard_model.create(
16
26
  {
17
27
  "show_move_line_details": True,
18
28
  "receivable_accounts_only": True,
19
29
  }
20
30
  )
31
+ cls.wizard_without_line_details = cls.wizard_model.create(
32
+ {
33
+ "show_move_line_details": False,
34
+ "receivable_accounts_only": True,
35
+ }
36
+ )
37
+ cls.account_age_report_config = cls.env[
38
+ "account.age.report.configuration"
39
+ ].create(
40
+ {
41
+ "name": "Intervals configuration",
42
+ "line_ids": [
43
+ (
44
+ 0,
45
+ 0,
46
+ {
47
+ "name": "1-30",
48
+ "inferior_limit": 30,
49
+ },
50
+ ),
51
+ ],
52
+ }
53
+ )
54
+
55
+ def test_report_without_aged_report_configuration(self):
56
+ """Check that report is produced correctly."""
57
+ wizard = self.wizard_with_line_details
58
+ wizard.onchange_type_accounts_only()
59
+ data = wizard._prepare_report_data()
60
+
61
+ # Simulate web client behavior:
62
+ # default value is a datetime.date but web client sends back strings
63
+ data.update({"date_at": data["date_at"].strftime(DEFAULT_SERVER_DATE_FORMAT)})
64
+ result = test_reports.try_report(
65
+ self.env.cr,
66
+ self.env.uid,
67
+ "account_financial_report.aged_partner_balance",
68
+ wizard.ids,
69
+ data=data,
70
+ )
71
+ self.assertTrue(result)
72
+ second_wizard = self.wizard_without_line_details
73
+ second_wizard.onchange_type_accounts_only()
74
+ data = second_wizard._prepare_report_data()
75
+
76
+ # Simulate web client behavior:
77
+ # default value is a datetime.date but web client sends back strings
78
+ data.update({"date_at": data["date_at"].strftime(DEFAULT_SERVER_DATE_FORMAT)})
79
+ result = test_reports.try_report(
80
+ self.env.cr,
81
+ self.env.uid,
82
+ "account_financial_report.aged_partner_balance",
83
+ second_wizard.ids,
84
+ data=data,
85
+ )
86
+ self.assertTrue(result)
87
+
88
+ def test_report_with_aged_report_configuration(self):
89
+ """Check that report is produced correctly."""
90
+ wizard = self.wizard_with_line_details
91
+ wizard.age_partner_config_id = self.account_age_report_config.id
92
+
21
93
  wizard.onchange_type_accounts_only()
22
- data = wizard._prepare_report_aged_partner_balance()
94
+ data = wizard._prepare_report_data()
23
95
 
24
96
  # Simulate web client behavior:
25
97
  # default value is a datetime.date but web client sends back strings
@@ -32,3 +104,21 @@ class TestAgedPartnerBalance(TransactionCase):
32
104
  data=data,
33
105
  )
34
106
  self.assertTrue(result)
107
+
108
+ second_wizard = self.wizard_without_line_details
109
+ second_wizard.age_partner_config_id = self.account_age_report_config.id
110
+
111
+ second_wizard.onchange_type_accounts_only()
112
+ data = second_wizard._prepare_report_data()
113
+
114
+ # Simulate web client behavior:
115
+ # default value is a datetime.date but web client sends back strings
116
+ data.update({"date_at": data["date_at"].strftime(DEFAULT_SERVER_DATE_FORMAT)})
117
+ result = test_reports.try_report(
118
+ self.env.cr,
119
+ self.env.uid,
120
+ "account_financial_report.aged_partner_balance",
121
+ second_wizard.ids,
122
+ data=data,
123
+ )
124
+ self.assertTrue(result)
@@ -15,8 +15,18 @@ from odoo.addons.account.tests.common import AccountTestInvoicingCommon
15
15
  @tagged("post_install", "-at_install")
16
16
  class TestGeneralLedgerReport(AccountTestInvoicingCommon):
17
17
  @classmethod
18
- def setUpClass(cls, chart_template_ref=None):
19
- super().setUpClass(chart_template_ref=chart_template_ref)
18
+ def setUpClass(cls):
19
+ super().setUpClass()
20
+ cls.env = cls.env(
21
+ context=dict(
22
+ cls.env.context,
23
+ mail_create_nolog=True,
24
+ mail_create_nosubscribe=True,
25
+ mail_notrack=True,
26
+ no_reset_password=True,
27
+ tracking_disable=True,
28
+ )
29
+ )
20
30
  cls.before_previous_fy_year = fields.Date.from_string("2014-05-05")
21
31
  cls.previous_fy_date_start = fields.Date.from_string("2015-01-01")
22
32
  cls.previous_fy_date_end = fields.Date.from_string("2015-12-31")
@@ -28,11 +38,11 @@ class TestGeneralLedgerReport(AccountTestInvoicingCommon):
28
38
  cls.unaffected_account = cls.env["account.account"].search(
29
39
  [
30
40
  (
31
- "user_type_id",
41
+ "account_type",
32
42
  "=",
33
- cls.env.ref("account.data_unaffected_earnings").id,
43
+ "equity_unaffected",
34
44
  ),
35
- ("company_id", "=", cls.env.user.company_id.id),
45
+ ("company_ids", "in", [cls.env.user.company_id.id]),
36
46
  ],
37
47
  limit=1,
38
48
  )
@@ -108,7 +118,7 @@ class TestGeneralLedgerReport(AccountTestInvoicingCommon):
108
118
  "centralize": centralize,
109
119
  }
110
120
  )
111
- data = general_ledger._prepare_report_general_ledger()
121
+ data = general_ledger._prepare_report_data()
112
122
  res_data = self.env[
113
123
  "report.account_financial_report.general_ledger"
114
124
  ]._get_report_values(general_ledger, data)
@@ -128,7 +138,7 @@ class TestGeneralLedgerReport(AccountTestInvoicingCommon):
128
138
  partner_in_report = False
129
139
  for account in general_ledger:
130
140
  if account["id"] == account_id and account["partners"]:
131
- for partner in account["list_partner"]:
141
+ for partner in account["list_grouped"]:
132
142
  if partner["id"] == partner_id:
133
143
  partner_in_report = True
134
144
  return partner_in_report
@@ -146,7 +156,7 @@ class TestGeneralLedgerReport(AccountTestInvoicingCommon):
146
156
  initial_balance = False
147
157
  for account in general_ledger:
148
158
  if account["id"] == account_id and account["partners"]:
149
- for partner in account["list_partner"]:
159
+ for partner in account["list_grouped"]:
150
160
  if partner["id"] == partner_id:
151
161
  initial_balance = partner["init_bal"]
152
162
  return initial_balance
@@ -164,7 +174,7 @@ class TestGeneralLedgerReport(AccountTestInvoicingCommon):
164
174
  final_balance = False
165
175
  for account in general_ledger:
166
176
  if account["id"] == account_id and account["partners"]:
167
- for partner in account["list_partner"]:
177
+ for partner in account["list_grouped"]:
168
178
  if partner["id"] == partner_id:
169
179
  final_balance = partner["fin_bal"]
170
180
  return final_balance
@@ -7,8 +7,7 @@ from datetime import datetime
7
7
  from dateutil.relativedelta import relativedelta
8
8
 
9
9
  from odoo.fields import Date
10
- from odoo.tests import tagged
11
- from odoo.tests.common import Form
10
+ from odoo.tests import Form, tagged
12
11
 
13
12
  from odoo.addons.account.tests.common import AccountTestInvoicingCommon
14
13
 
@@ -16,8 +15,18 @@ from odoo.addons.account.tests.common import AccountTestInvoicingCommon
16
15
  @tagged("post_install", "-at_install")
17
16
  class TestJournalReport(AccountTestInvoicingCommon):
18
17
  @classmethod
19
- def setUpClass(cls, chart_template_ref=None):
20
- super().setUpClass(chart_template_ref=chart_template_ref)
18
+ def setUpClass(cls):
19
+ super().setUpClass()
20
+ cls.env = cls.env(
21
+ context=dict(
22
+ cls.env.context,
23
+ mail_create_nolog=True,
24
+ mail_create_nosubscribe=True,
25
+ mail_notrack=True,
26
+ no_reset_password=True,
27
+ tracking_disable=True,
28
+ )
29
+ )
21
30
  cls.AccountObj = cls.env["account.account"]
22
31
  cls.InvoiceObj = cls.env["account.move"]
23
32
  cls.JournalObj = cls.env["account.journal"]
@@ -167,7 +176,7 @@ class TestJournalReport(AccountTestInvoicingCommon):
167
176
  "move_target": "all",
168
177
  }
169
178
  )
170
- data = wiz._prepare_report_journal_ledger()
179
+ data = wiz._prepare_report_data()
171
180
  res_data = self.JournalLedgerReport._get_report_values(wiz, data)
172
181
  self.check_report_journal_debit_credit(res_data, 100, 100)
173
182
 
@@ -176,7 +185,7 @@ class TestJournalReport(AccountTestInvoicingCommon):
176
185
  res_data = self.JournalLedgerReport._get_report_values(wiz, data)
177
186
  self.check_report_journal_debit_credit(res_data, 200, 200)
178
187
  wiz.move_target = "posted"
179
- data = wiz._prepare_report_journal_ledger()
188
+ data = wiz._prepare_report_data()
180
189
  res_data = self.JournalLedgerReport._get_report_values(wiz, data)
181
190
  self.check_report_journal_debit_credit(res_data, 0, 0)
182
191
 
@@ -193,7 +202,7 @@ class TestJournalReport(AccountTestInvoicingCommon):
193
202
  self.check_report_journal_debit_credit(res_data, 200, 200)
194
203
 
195
204
  wiz.date_from = self.previous_fy_date_start
196
- data = wiz._prepare_report_journal_ledger()
205
+ data = wiz._prepare_report_data()
197
206
  res_data = self.JournalLedgerReport._get_report_values(wiz, data)
198
207
  self.check_report_journal_debit_credit(res_data, 300, 300)
199
208
 
@@ -228,7 +237,7 @@ class TestJournalReport(AccountTestInvoicingCommon):
228
237
  "move_target": "all",
229
238
  }
230
239
  )
231
- data = wiz._prepare_report_journal_ledger()
240
+ data = wiz._prepare_report_data()
232
241
  res_data = self.JournalLedgerReport._get_report_values(wiz, data)
233
242
  self.check_report_journal_debit_credit(res_data, 250, 250)
234
243
  self.check_report_journal_debit_credit_taxes(res_data, 0, 300, 0, 50)
@@ -266,7 +275,7 @@ class TestJournalReport(AccountTestInvoicingCommon):
266
275
  "move_target": "all",
267
276
  }
268
277
  )
269
- data = wiz._prepare_report_journal_ledger()
278
+ data = wiz._prepare_report_data()
270
279
  res_data = self.JournalLedgerReport._get_report_values(wiz, data)
271
280
 
272
281
  self.check_report_journal_debit_credit(res_data, 250, 250)