odoo-addon-mis-builder 17.0.1.2.1.1__py3-none-any.whl → 18.0.1.0.0.11__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 (57) hide show
  1. odoo/addons/mis_builder/README.rst +7 -6
  2. odoo/addons/mis_builder/__manifest__.py +3 -3
  3. odoo/addons/mis_builder/datas/ir_cron.xml +1 -3
  4. odoo/addons/mis_builder/i18n/ca.po +8 -51
  5. odoo/addons/mis_builder/i18n/de.po +4 -39
  6. odoo/addons/mis_builder/i18n/el.po +4 -39
  7. odoo/addons/mis_builder/i18n/el_GR.po +4 -39
  8. odoo/addons/mis_builder/i18n/es.po +12 -65
  9. odoo/addons/mis_builder/i18n/fr.po +12 -65
  10. odoo/addons/mis_builder/i18n/hr.po +4 -39
  11. odoo/addons/mis_builder/i18n/it.po +13 -80
  12. odoo/addons/mis_builder/i18n/mis_builder.pot +13 -125
  13. odoo/addons/mis_builder/i18n/nl.po +4 -39
  14. odoo/addons/mis_builder/i18n/nl_NL.po +4 -39
  15. odoo/addons/mis_builder/i18n/pt.po +4 -39
  16. odoo/addons/mis_builder/i18n/pt_BR.po +13 -64
  17. odoo/addons/mis_builder/i18n/sv.po +12 -64
  18. odoo/addons/mis_builder/i18n/tr.po +4 -39
  19. odoo/addons/mis_builder/i18n/zh_CN.po +78 -154
  20. odoo/addons/mis_builder/models/aep.py +62 -160
  21. odoo/addons/mis_builder/models/aggregate.py +4 -4
  22. odoo/addons/mis_builder/models/kpimatrix.py +9 -10
  23. odoo/addons/mis_builder/models/mis_kpi_data.py +5 -7
  24. odoo/addons/mis_builder/models/mis_report.py +47 -58
  25. odoo/addons/mis_builder/models/mis_report_instance.py +42 -25
  26. odoo/addons/mis_builder/models/mis_report_style.py +9 -12
  27. odoo/addons/mis_builder/models/mis_report_subreport.py +5 -4
  28. odoo/addons/mis_builder/models/prorata_read_group_mixin.py +51 -31
  29. odoo/addons/mis_builder/models/simple_array.py +2 -2
  30. odoo/addons/mis_builder/readme/CONTRIBUTORS.md +1 -0
  31. odoo/addons/mis_builder/report/mis_report_instance_xlsx.py +2 -2
  32. odoo/addons/mis_builder/static/description/index.html +5 -4
  33. odoo/addons/mis_builder/static/src/components/mis_report_widget.esm.js +12 -21
  34. odoo/addons/mis_builder/static/src/components/mis_report_widget.scss +68 -0
  35. odoo/addons/mis_builder/static/src/components/mis_report_widget.xml +9 -14
  36. odoo/addons/mis_builder/static/src/scss/report.scss +49 -0
  37. odoo/addons/mis_builder/tests/__init__.py +1 -0
  38. odoo/addons/mis_builder/tests/common.py +2 -4
  39. odoo/addons/mis_builder/tests/fake_models.py +18 -1
  40. odoo/addons/mis_builder/tests/test_aep.py +7 -69
  41. odoo/addons/mis_builder/tests/test_data_sources.py +4 -11
  42. odoo/addons/mis_builder/tests/test_kpi_data.py +1 -5
  43. odoo/addons/mis_builder/tests/test_mis_report_instance.py +21 -17
  44. odoo/addons/mis_builder/tests/test_multi_company_aep.py +3 -3
  45. odoo/addons/mis_builder/tests/test_pro_rata_read_group.py +105 -0
  46. odoo/addons/mis_builder/views/mis_report.xml +38 -43
  47. odoo/addons/mis_builder/views/mis_report_instance.xml +37 -40
  48. odoo/addons/mis_builder/views/mis_report_style.xml +6 -6
  49. odoo/addons/mis_builder/wizard/mis_builder_dashboard.py +3 -3
  50. odoo/addons/mis_builder/wizard/mis_builder_dashboard.xml +6 -6
  51. {odoo_addon_mis_builder-17.0.1.2.1.1.dist-info → odoo_addon_mis_builder-18.0.1.0.0.11.dist-info}/METADATA +12 -11
  52. odoo_addon_mis_builder-18.0.1.0.0.11.dist-info/RECORD +87 -0
  53. odoo/addons/mis_builder/static/src/components/mis_report_widget.css +0 -67
  54. odoo/addons/mis_builder/static/src/css/report.css +0 -46
  55. odoo_addon_mis_builder-17.0.1.2.1.1.dist-info/RECORD +0 -86
  56. {odoo_addon_mis_builder-17.0.1.2.1.1.dist-info → odoo_addon_mis_builder-18.0.1.0.0.11.dist-info}/WHEEL +0 -0
  57. {odoo_addon_mis_builder-17.0.1.2.1.1.dist-info → odoo_addon_mis_builder-18.0.1.0.0.11.dist-info}/top_level.txt +0 -0
@@ -367,9 +367,9 @@ ul.auto-toc {
367
367
  !! This file is generated by oca-gen-addon-readme !!
368
368
  !! changes will be overwritten. !!
369
369
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
370
- !! source digest: sha256:b1c757f0e7b435600076d75a90bfb1bcc766368d4513957efb2316e2c3efd599
370
+ !! source digest: sha256:4f951807886cf621fb36273acfadb6571fdb553df0d02b7a2574eceb88aa0058
371
371
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
372
- <p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Production/Stable" src="https://img.shields.io/badge/maturity-Production%2FStable-green.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/mis-builder/tree/17.0/mis_builder"><img alt="OCA/mis-builder" src="https://img.shields.io/badge/github-OCA%2Fmis--builder-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/mis-builder-17-0/mis-builder-17-0-mis_builder"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/mis-builder&amp;target_branch=17.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
372
+ <p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Production/Stable" src="https://img.shields.io/badge/maturity-Production%2FStable-green.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/mis-builder/tree/18.0/mis_builder"><img alt="OCA/mis-builder" src="https://img.shields.io/badge/github-OCA%2Fmis--builder-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/mis-builder-18-0/mis-builder-18-0-mis_builder"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/mis-builder&amp;target_branch=18.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
373
373
  <p>This module allows you to build Management Information Systems
374
374
  dashboards. Such style of reports presents KPI in rows and time periods
375
375
  in columns. Reports mainly fetch data from account moves, but can also
@@ -1081,7 +1081,7 @@ previews. <a class="reference external" href="https://github.com/OCA/account-fin
1081
1081
  <p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/mis-builder/issues">GitHub Issues</a>.
1082
1082
  In case of trouble, please check there if your issue has already been reported.
1083
1083
  If you spotted it first, help us to smash it by providing a detailed and welcomed
1084
- <a class="reference external" href="https://github.com/OCA/mis-builder/issues/new?body=module:%20mis_builder%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
1084
+ <a class="reference external" href="https://github.com/OCA/mis-builder/issues/new?body=module:%20mis_builder%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
1085
1085
  <p>Do not contact contributors directly about support or help with technical issues.</p>
1086
1086
  </div>
1087
1087
  <div class="section" id="credits">
@@ -1124,6 +1124,7 @@ If you spotted it first, help us to smash it by providing a detailed and welcome
1124
1124
  <li>Hoang Diep &lt;<a class="reference external" href="mailto:hoang&#64;trobz.com">hoang&#64;trobz.com</a>&gt;</li>
1125
1125
  <li>Miquel Pascual &lt;<a class="reference external" href="mailto:mpascual&#64;apsl.net">mpascual&#64;apsl.net</a>&gt;</li>
1126
1126
  <li>Antoni Marroig &lt;<a class="reference external" href="mailto:amarroig&#64;apsl.net">amarroig&#64;apsl.net</a>&gt;</li>
1127
+ <li>Chau Le &lt;<a class="reference external" href="mailto:chaulb&#64;trobz.com">chaulb&#64;trobz.com</a>&gt;</li>
1127
1128
  </ul>
1128
1129
  </div>
1129
1130
  <div class="section" id="maintainers">
@@ -1137,7 +1138,7 @@ mission is to support the collaborative development of Odoo features and
1137
1138
  promote its widespread use.</p>
1138
1139
  <p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainer</a>:</p>
1139
1140
  <p><a class="reference external image-reference" href="https://github.com/sbidoul"><img alt="sbidoul" src="https://github.com/sbidoul.png?size=40px" /></a></p>
1140
- <p>This module is part of the <a class="reference external" href="https://github.com/OCA/mis-builder/tree/17.0/mis_builder">OCA/mis-builder</a> project on GitHub.</p>
1141
+ <p>This module is part of the <a class="reference external" href="https://github.com/OCA/mis-builder/tree/18.0/mis_builder">OCA/mis-builder</a> project on GitHub.</p>
1141
1142
  <p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
1142
1143
  </div>
1143
1144
  </div>
@@ -1,5 +1,3 @@
1
- /** @odoo-module **/
2
-
3
1
  import {Component, onWillStart, useState, useSubEnv} from "@odoo/owl";
4
2
  import {useBus, useService} from "@web/core/utils/hooks";
5
3
  import {DateTimeInput} from "@web/core/datetime/datetime_input";
@@ -12,7 +10,6 @@ export class MisReportWidget extends Component {
12
10
  setup() {
13
11
  super.setup();
14
12
  this.orm = useService("orm");
15
- this.user = useService("user");
16
13
  this.action = useService("action");
17
14
  this.view = useService("view");
18
15
  this.JSON = JSON;
@@ -21,7 +18,6 @@ export class MisReportWidget extends Component {
21
18
  pivot_date: null,
22
19
  });
23
20
  this.searchModel = new SearchModel(this.env, {
24
- user: this.user,
25
21
  orm: this.orm,
26
22
  view: this.view,
27
23
  });
@@ -48,13 +44,14 @@ export class MisReportWidget extends Component {
48
44
  ],
49
45
  {context: this.context}
50
46
  );
47
+
51
48
  this.source_aml_model_name = result.source_aml_model_name;
52
49
  this.widget_show_filters = result.widget_show_filters;
53
50
  this.widget_show_settings_button = result.widget_show_settings_button;
54
- this.widget_search_view_id =
55
- result.widget_search_view_id && result.widget_search_view_id[0];
51
+ this.widget_search_view_id = result.widget_search_view_id?.[0];
56
52
  this.state.pivot_date = parseDate(result.pivot_date);
57
53
  this.widget_show_pivot_date = result.widget_show_pivot_date;
54
+
58
55
  if (this.showSearchBar) {
59
56
  // Initialize the search model
60
57
  await this.searchModel.load({
@@ -96,31 +93,25 @@ export class MisReportWidget extends Component {
96
93
  * of Odoo dashboards that are not designed to contain forms but
97
94
  * rather tree views or charts.
98
95
  */
99
- var context = this.props.record.context;
96
+ const context = this.props.record.context;
100
97
  if (context.active_model === "mis.report.instance") {
101
98
  return context.active_id;
102
99
  }
103
100
  }
104
101
 
105
102
  get context() {
106
- var ctx = super.context;
107
- if (this.showSearchBar) {
108
- ctx = {
109
- ...ctx,
103
+ return {
104
+ ...super.context,
105
+ ...(this.showSearchBar && {
110
106
  mis_analytic_domain: this.searchModel.searchDomain,
111
- };
112
- }
113
- if (this.showPivotDate && this.state.pivot_date) {
114
- ctx = {
115
- ...ctx,
116
- mis_pivot_date: this.state.pivot_date,
117
- };
118
- }
119
- return ctx;
107
+ }),
108
+ ...(this.showPivotDate &&
109
+ this.state.pivot_date && {mis_pivot_date: this.state.pivot_date}),
110
+ };
120
111
  }
121
112
 
122
113
  async drilldown(event) {
123
- const drilldown = $(event.target).data("drilldown");
114
+ const drilldown = JSON.parse(event.target.dataset.drilldown);
124
115
  const action = await this.orm.call(
125
116
  "mis.report.instance",
126
117
  "drilldown",
@@ -0,0 +1,68 @@
1
+ .o_web_client {
2
+ .mis_builder_amount {
3
+ text-align: right;
4
+ }
5
+
6
+ .mis_builder_collabel {
7
+ text-align: center;
8
+ }
9
+
10
+ .mis_builder_rowlabel {
11
+ text-align: left;
12
+ }
13
+
14
+ .mis_builder {
15
+ a {
16
+ // we don't want the link color, to respect user styles
17
+ color: inherit;
18
+
19
+ &:hover {
20
+ // underline links on hover to give a visual cue
21
+ text-decoration: underline;
22
+ }
23
+ }
24
+ }
25
+ }
26
+
27
+ /* style for the control panel (search box and buttons) */
28
+
29
+ .oe_mis_builder_cp {
30
+ display: flex;
31
+ flex-direction: row;
32
+ padding-bottom: 20px;
33
+
34
+ .oe_mis_builder_cp_left {
35
+ display: flex;
36
+ flex-direction: column;
37
+ flex-grow: 1;
38
+ }
39
+
40
+ .oe_mis_builder_cp_right {
41
+ display: flex;
42
+ flex-direction: column;
43
+ flex-grow: 2;
44
+ max-width: 1280px;
45
+
46
+ &_top {
47
+ display: flex;
48
+ flex-direction: row;
49
+ }
50
+
51
+ &_bottom {
52
+ display: flex;
53
+ flex-direction: row;
54
+ }
55
+
56
+ .oe_mis_builder_filter_buttons {
57
+ display: flex;
58
+ flex-grow: 1;
59
+ justify-content: flex-start;
60
+ }
61
+
62
+ .oe_mis_builder_action_buttons {
63
+ display: flex;
64
+ flex-grow: 1;
65
+ justify-content: flex-end;
66
+ }
67
+ }
68
+ }
@@ -1,12 +1,10 @@
1
1
  <?xml version="1.0" encoding="utf-8" ?>
2
2
  <templates>
3
-
4
3
  <t t-name="mis_builder.MisReportWidget">
5
4
  <div class="oe_mis_builder_content">
6
5
  <t t-if="state.mis_report_data">
7
6
  <div class="oe_mis_builder_cp">
8
- <div class="oe_mis_builder_cp_left">
9
- </div>
7
+ <div class="oe_mis_builder_cp_left" />
10
8
  <div class="oe_mis_builder_cp_right">
11
9
  <div class="oe_mis_builder_cp_right_top">
12
10
  <SearchBar t-if="showSearchBar" />
@@ -18,7 +16,7 @@
18
16
  placeholder="'Base date...'"
19
17
  type="'date'"
20
18
  t-if="showPivotDate"
21
- onChange="onDateTimeChanged.bind(this)"
19
+ onChange.bind="onDateTimeChanged"
22
20
  />
23
21
  </div>
24
22
  <div class="oe_mis_builder_action_buttons">
@@ -49,9 +47,7 @@
49
47
  t-key="row_index"
50
48
  class="oe_list_header_columns"
51
49
  >
52
- <th class="oe_list_header_char">
53
-
54
- </th>
50
+ <th class="oe_list_header_char" />
55
51
  <th
56
52
  t-foreach="row.cols"
57
53
  t-as="col"
@@ -59,10 +55,10 @@
59
55
  class="oe_list_header_char mis_builder_collabel"
60
56
  t-att-colspan="col.colspan"
61
57
  >
62
- <t t-esc="col.label" />
58
+ <t t-out="col.label" />
63
59
  <t t-if="col.description">
64
60
  <br />
65
- <t t-esc="col.description" />
61
+ <t t-out="col.description" />
66
62
  </t>
67
63
  </th>
68
64
  </tr>
@@ -74,10 +70,10 @@
74
70
  t-key="row_index"
75
71
  >
76
72
  <td t-att="{'style': row.style}">
77
- <t t-esc="row.label" />
73
+ <t t-out="row.label" />
78
74
  <t t-if="row.description">
79
75
  <br />
80
- <t t-esc="row.description" />
76
+ <t t-out="row.description" />
81
77
  </t>
82
78
  </td>
83
79
  <td
@@ -94,11 +90,11 @@
94
90
  t-on-click="drilldown"
95
91
  t-att-data-drilldown="JSON.stringify(cell.drilldown_arg)"
96
92
  >
97
- <t t-esc="cell.val_r" />
93
+ <t t-out="cell.val_r" />
98
94
  </a>
99
95
  </t>
100
96
  <t t-if="!cell.drilldown_arg">
101
- <t t-esc="cell.val_r" />
97
+ <t t-out="cell.val_r" />
102
98
  </t>
103
99
  </td>
104
100
  </tr>
@@ -111,5 +107,4 @@
111
107
  </t>
112
108
  </div>
113
109
  </t>
114
-
115
110
  </templates>
@@ -0,0 +1,49 @@
1
+ .mis_table {
2
+ display: table;
3
+ width: 100%;
4
+ table-layout: fixed;
5
+
6
+ .mis_row {
7
+ display: table-row;
8
+ page-break-inside: avoid;
9
+ border-color: grey;
10
+ border-bottom: 1px solid lightGrey;
11
+ }
12
+
13
+ .mis_cell {
14
+ display: table-cell;
15
+ page-break-inside: avoid;
16
+
17
+ &.mis_collabel {
18
+ font-weight: bold;
19
+ background-color: #f0f0f0;
20
+ text-align: center;
21
+ }
22
+
23
+ &.mis_rowlabel {
24
+ text-align: left;
25
+ /* white-space: nowrap; */
26
+ }
27
+
28
+ &.mis_amount {
29
+ text-align: right;
30
+ }
31
+ }
32
+
33
+ &,
34
+ .mis_row {
35
+ border-left: 0;
36
+ border-right: 0;
37
+ text-align: left;
38
+ padding: 2px 3px;
39
+ border-collapse: collapse;
40
+ }
41
+ }
42
+
43
+ .mis_thead {
44
+ display: table-header-group;
45
+ }
46
+
47
+ .mis_tbody {
48
+ display: table-row-group;
49
+ }
@@ -10,6 +10,7 @@ from . import test_kpi_data
10
10
  from . import test_mis_report_instance
11
11
  from . import test_mis_safe_eval
12
12
  from . import test_period_dates
13
+ from . import test_pro_rata_read_group
13
14
  from . import test_render
14
15
  from . import test_simple_array
15
16
  from . import test_target_move
@@ -27,10 +27,8 @@ def assert_matrix(matrix, expected):
27
27
  raise AssertionError("too many rows")
28
28
  for j, cell, expected_val in _zip(row.iter_cells(), expected_row):
29
29
  assert (
30
- cell and cell.val
31
- ) == expected_val, "{} != {} in row {} col {}".format(
32
- cell and cell.val, expected_val, i, j
33
- )
30
+ (cell and cell.val) == expected_val
31
+ ), f"{cell and cell.val} != {expected_val} in row {i} col {j}"
34
32
 
35
33
 
36
34
  @tagged("doctest")
@@ -1,7 +1,24 @@
1
- from odoo import models
1
+ from odoo import fields, models
2
2
 
3
3
 
4
4
  class MisKpiDataTestItem(models.Model):
5
5
  _name = "mis.kpi.data.test.item"
6
6
  _inherit = "mis.kpi.data"
7
7
  _description = "MIS Kpi Data test item"
8
+
9
+
10
+ class ProrataReadGroupThing(models.Model):
11
+ _name = "prorata.read.group.thing"
12
+ _inherit = "prorata.read_group.mixin"
13
+ _description = "Prorata Read Group Thing"
14
+
15
+ date_from = fields.Date(required=True)
16
+ date_to = fields.Date(required=True)
17
+ account_code = fields.Char(required=True)
18
+ debit = fields.Float()
19
+ credit = fields.Float()
20
+ company_id = fields.Many2one(
21
+ "res.company",
22
+ required=True,
23
+ default=lambda self: self.env.company,
24
+ )
@@ -9,13 +9,9 @@ from odoo import fields
9
9
  from odoo.exceptions import UserError
10
10
  from odoo.tools.safe_eval import safe_eval
11
11
 
12
- from ..models import aep
13
12
  from ..models.accounting_none import AccountingNone
14
13
  from ..models.aep import AccountingExpressionProcessor as AEP
15
14
  from ..models.aep import _is_domain
16
- from .common import load_doctests
17
-
18
- load_tests = load_doctests(aep)
19
15
 
20
16
 
21
17
  class TestAEP(common.TransactionCase):
@@ -39,7 +35,7 @@ class TestAEP(common.TransactionCase):
39
35
  # create receivable bs account
40
36
  self.account_ar = self.account_model.create(
41
37
  {
42
- "company_id": self.company.id,
38
+ "company_ids": self.company.ids,
43
39
  "code": "400AR",
44
40
  "name": "Receivable",
45
41
  "account_type": "asset_receivable",
@@ -49,20 +45,12 @@ class TestAEP(common.TransactionCase):
49
45
  # create income pl account
50
46
  self.account_in = self.account_model.create(
51
47
  {
52
- "company_id": self.company.id,
48
+ "company_ids": self.company.ids,
53
49
  "code": "700IN",
54
50
  "name": "Income",
55
51
  "account_type": "income",
56
52
  }
57
53
  )
58
- self.account_in_no_data = self.account_model.create(
59
- {
60
- "company_id": self.company.id,
61
- "code": "700INNODATA",
62
- "name": "Income (no data)",
63
- "account_type": "income",
64
- }
65
- )
66
54
  # create journal
67
55
  self.journal = self.journal_model.create(
68
56
  {
@@ -85,7 +73,6 @@ class TestAEP(common.TransactionCase):
85
73
  amount=300,
86
74
  debit_acc=self.account_ar,
87
75
  credit_acc=self.account_in,
88
- credit_quantity=3,
89
76
  )
90
77
  # create move in March this year
91
78
  self._create_move(
@@ -111,8 +98,6 @@ class TestAEP(common.TransactionCase):
111
98
  self.aep.parse_expr("crdp[700I%]")
112
99
  self.aep.parse_expr("bali[400%]")
113
100
  self.aep.parse_expr("bale[700%]")
114
- self.aep.parse_expr("balp[700I%]")
115
- self.aep.parse_expr("fldp.quantity[700%]")
116
101
  self.aep.parse_expr("balp[]" "[('account_id.code', '=', '400AR')]")
117
102
  self.aep.parse_expr(
118
103
  "balp[]" "[('account_id.account_type', '=', " " 'asset_receivable')]"
@@ -127,32 +112,17 @@ class TestAEP(common.TransactionCase):
127
112
  self.aep.parse_expr("bal_700IN") # deprecated
128
113
  self.aep.parse_expr("bals[700IN]") # deprecated
129
114
 
130
- def _create_move(
131
- self, date, amount, debit_acc, credit_acc, post=True, credit_quantity=0
132
- ):
115
+ def _create_move(self, date, amount, debit_acc, credit_acc, post=True):
133
116
  move = self.move_model.create(
134
117
  {
135
118
  "journal_id": self.journal.id,
136
119
  "date": fields.Date.to_string(date),
137
120
  "line_ids": [
121
+ (0, 0, {"name": "/", "debit": amount, "account_id": debit_acc.id}),
138
122
  (
139
123
  0,
140
124
  0,
141
- {
142
- "name": "/",
143
- "debit": amount,
144
- "account_id": debit_acc.id,
145
- },
146
- ),
147
- (
148
- 0,
149
- 0,
150
- {
151
- "name": "/",
152
- "credit": amount,
153
- "account_id": credit_acc.id,
154
- "quantity": credit_quantity,
155
- },
125
+ {"name": "/", "credit": amount, "account_id": credit_acc.id},
156
126
  ),
157
127
  ],
158
128
  }
@@ -182,20 +152,6 @@ class TestAEP(common.TransactionCase):
182
152
  self.assertEqual(self.company.fiscalyear_last_day, 31)
183
153
  self.assertEqual(self.company.fiscalyear_last_month, "12")
184
154
 
185
- def test_parse_expr_error_handling(self):
186
- aep = AEP(self.company)
187
- with self.assertRaises(UserError) as cm:
188
- aep.parse_expr("fldi.quantity[700%]")
189
- self.assertIn(
190
- "`fld` can only be used with mode `p` (variation)", str(cm.exception)
191
- )
192
- with self.assertRaises(UserError) as cm:
193
- aep.parse_expr("fldp[700%]")
194
- self.assertIn("`fld` must have a field name", str(cm.exception))
195
- with self.assertRaises(UserError) as cm:
196
- aep.parse_expr("balp.quantity[700%]")
197
- self.assertIn("`bal` cannot have a field name", str(cm.exception))
198
-
199
155
  def test_aep_basic(self):
200
156
  self.aep.done_parsing()
201
157
  # let's query for december
@@ -247,8 +203,6 @@ class TestAEP(common.TransactionCase):
247
203
  self.assertEqual(self._eval("bale[700IN]"), -300)
248
204
  # check result for non existing account
249
205
  self.assertIs(self._eval("bale[700NA]"), AccountingNone)
250
- # check fldp.quantity
251
- self.assertEqual(self._eval("fldp.quantity[700%]"), 3)
252
206
 
253
207
  # let's query for March
254
208
  self._do_queries(
@@ -280,8 +234,6 @@ class TestAEP(common.TransactionCase):
280
234
  self.assertEqual(self._eval("debp[400A%]"), 500)
281
235
  self.assertEqual(self._eval("bal_700IN"), -500)
282
236
  self.assertEqual(self._eval("bals[700IN]"), -800)
283
- # check fldp.quantity
284
- self.assertEqual(self._eval("fldp.quantity[700%]"), 0)
285
237
 
286
238
  # unallocated p&l from previous year
287
239
  self.assertEqual(self._eval("balu[]"), -100)
@@ -315,17 +267,6 @@ class TestAEP(common.TransactionCase):
315
267
  end = self._eval_by_account_id("bale[]")
316
268
  self.assertEqual(end, {self.account_ar.id: 900, self.account_in.id: -800})
317
269
 
318
- def test_aep_by_account_no_data(self):
319
- """Test that accounts with no data are not returned."""
320
- self.aep.done_parsing()
321
- self._do_queries(
322
- datetime.date(self.curr_year, 3, 1), datetime.date(self.curr_year, 3, 31)
323
- )
324
- variation = self._eval("balp[700I%]")
325
- self.assertEqual(variation, -500)
326
- variation_by_account = self._eval_by_account_id("balp[700I%]")
327
- self.assertEqual(variation_by_account, {self.account_in.id: -500})
328
-
329
270
  def test_aep_convenience_methods(self):
330
271
  initial = AEP.get_balances_initial(self.company, time.strftime("%Y") + "-03-01")
331
272
  self.assertEqual(
@@ -378,13 +319,10 @@ class TestAEP(common.TransactionCase):
378
319
  self.assertEqual(account_ids, {self.account_in.id})
379
320
  expr = "balp[700%]"
380
321
  account_ids = self.aep.get_account_ids_for_expr(expr)
381
- self.assertEqual(account_ids, {self.account_in.id, self.account_in_no_data.id})
322
+ self.assertEqual(account_ids, {self.account_in.id})
382
323
  expr = "bali[400%], bale[700%]" # subkpis combined expression
383
324
  account_ids = self.aep.get_account_ids_for_expr(expr)
384
- self.assertEqual(
385
- account_ids,
386
- {self.account_in.id, self.account_ar.id, self.account_in_no_data.id},
387
- )
325
+ self.assertEqual(account_ids, {self.account_in.id, self.account_ar.id})
388
326
 
389
327
  def test_get_aml_domain_for_expr(self):
390
328
  self.aep.done_parsing()
@@ -2,6 +2,7 @@
2
2
  # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
3
3
 
4
4
  import odoo.tests.common as common
5
+ from odoo import Command
5
6
 
6
7
  from ..models.accounting_none import AccountingNone
7
8
  from ..models.mis_report import CMP_DIFF
@@ -35,14 +36,6 @@ class TestMisReportInstanceDataSources(common.TransactionCase):
35
36
  move._post()
36
37
  return move
37
38
 
38
- @classmethod
39
- def setUpClass(cls):
40
- super().setUpClass()
41
- # Perform the tests with a brand new company to avoid intrusive data from other
42
- # modules added to the default company
43
- cls.company = cls.env["res.company"].create({"name": "Company Test"})
44
- cls.env.user.company_id = cls.company
45
-
46
39
  def setUp(self):
47
40
  super().setUp()
48
41
  self.account_model = self.env["account.account"]
@@ -51,7 +44,7 @@ class TestMisReportInstanceDataSources(common.TransactionCase):
51
44
  # create receivable bs account
52
45
  self.account_ar = self.account_model.create(
53
46
  {
54
- "company_id": self.env.user.company_id.id,
47
+ "company_ids": [Command.link(self.env.user.company_id.id)],
55
48
  "code": "400AR",
56
49
  "name": "Receivable",
57
50
  "account_type": "asset_receivable",
@@ -61,7 +54,7 @@ class TestMisReportInstanceDataSources(common.TransactionCase):
61
54
  # create income account
62
55
  self.account_in = self.account_model.create(
63
56
  {
64
- "company_id": self.env.user.company_id.id,
57
+ "company_ids": [Command.link(self.env.user.company_id.id)],
65
58
  "code": "700IN",
66
59
  "name": "Income",
67
60
  "account_type": "income",
@@ -69,7 +62,7 @@ class TestMisReportInstanceDataSources(common.TransactionCase):
69
62
  )
70
63
  self.account_in2 = self.account_model.create(
71
64
  {
72
- "company_id": self.env.user.company_id.id,
65
+ "company_ids": [Command.link(self.env.user.company_id.id)],
73
66
  "code": "700IN2",
74
67
  "name": "Income",
75
68
  "account_type": "income",
@@ -18,6 +18,7 @@ class TestKpiData(TransactionCase):
18
18
  from .fake_models import MisKpiDataTestItem
19
19
 
20
20
  cls.loader.update_registry((MisKpiDataTestItem,))
21
+ cls.addClassCleanup(cls.loader.restore_registry)
21
22
 
22
23
  report = cls.env["mis.report"].create(dict(name="test report"))
23
24
  cls.kpi1 = cls.env["mis.report.kpi"].create(
@@ -71,11 +72,6 @@ class TestKpiData(TransactionCase):
71
72
  )
72
73
  )
73
74
 
74
- @classmethod
75
- def tearDownClass(cls):
76
- cls.loader.restore_registry()
77
- return super().tearDownClass()
78
-
79
75
  def test_kpi_data_name(self):
80
76
  self.assertEqual(self.kd11.name, "k1: 2017-05-01 - 2017-05-10")
81
77
  self.assertEqual(self.kd12.name, "k1: 2017-05-11 - 2017-05-20")