diff --git a/README.md b/README.md
index 1de087d..02dc14c 100644
--- a/README.md
+++ b/README.md
@@ -11,6 +11,6 @@ addon | version | summary
--- | --- | ---
[mis_builder_budget](mis_builder_budget/) | 3.0.1.2.0| Create budgets for MIS reports
[mis_builder_demo](mis_builder_demo/) | 3.0.1.0.0| Demo addon for MIS Builder
-[mis_builder](mis_builder/) | 3.0.1.0.1| Build 'Management Information System' Reports and Dashboards
+[mis_builder](mis_builder/) | 3.0.1.0.4| Build 'Management Information System' Reports and Dashboards
diff --git a/mis_builder/README.rst b/mis_builder/README.rst
index 7d62217..25b168f 100644
--- a/mis_builder/README.rst
+++ b/mis_builder/README.rst
@@ -7,7 +7,7 @@ MIS Builder
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- !! source digest: sha256:b77109780c345283441ae799e88053caf41557f5746ecbd96ff63cb08c081d35
+ !! source digest: sha256:cb9411126609016ab4d14f56da97fa22dbdecf81b69ec9e091a431a47eb27011
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Production%2FStable-green.png
@@ -100,6 +100,15 @@ can be found on GitHub.
Changelog
=========
+17.0.1.0.2 (2024-11-11)
+-----------------------
+
+Features
+~~~~~~~~
+
+- Add support for branch companies.
+ (`#648 `__)
+
16.0.5.1.9 (2024-02-09)
-----------------------
diff --git a/mis_builder/__manifest__.py b/mis_builder/__manifest__.py
index 8e8e996..9555fa2 100644
--- a/mis_builder/__manifest__.py
+++ b/mis_builder/__manifest__.py
@@ -3,7 +3,7 @@
{
"name": "MIS Builder",
- "version": "3.0.1.0.1",
+ "version": "3.0.1.0.4",
"category": "Reporting",
"summary": """
Build 'Management Information System' Reports and Dashboards
diff --git a/mis_builder/i18n/zh_CN.po b/mis_builder/i18n/zh_CN.po
index 1ee1111..3572422 100644
--- a/mis_builder/i18n/zh_CN.po
+++ b/mis_builder/i18n/zh_CN.po
@@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 17.0\n"
"Report-Msgid-Bugs-To: \n"
-"PO-Revision-Date: 2024-08-27 12:06+0000\n"
+"PO-Revision-Date: 2024-11-15 10:06+0000\n"
"Last-Translator: xtanuiha \n"
"Language-Team: none\n"
"Language: zh_CN\n"
@@ -95,7 +95,7 @@ msgid ""
" positive balance, negative balance."
msgstr ""
"bal
, crd
, deb
, pbal
, "
-"nbal
: 余额,借方,贷方,正余额,负余额。"
+"nbal
: 余额,贷方,借方,正余额,负余额。"
#. module: mis_builder
#: model_terms:ir.ui.view,arch_db:mis_builder.mis_report_view_kpi_form
diff --git a/mis_builder/models/aep.py b/mis_builder/models/aep.py
index ba8e97a..9ff1ca1 100644
--- a/mis_builder/models/aep.py
+++ b/mis_builder/models/aep.py
@@ -12,6 +12,7 @@ from flectra.tools.float_utils import float_is_zero
from flectra.tools.safe_eval import datetime, dateutil, safe_eval, time
from .accounting_none import AccountingNone
+from .simple_array import SimpleArray
_logger = logging.getLogger(__name__)
@@ -316,7 +317,11 @@ class AccountingExpressionProcessor:
aml_model = aml_model.with_context(active_test=False)
company_rates = self._get_company_rates(date_to)
# {(domain, mode): {account_id: (debit, credit)}}
- self._data = defaultdict(dict)
+ self._data = defaultdict(
+ lambda: defaultdict(
+ lambda: SimpleArray((AccountingNone, AccountingNone)),
+ )
+ )
domain_by_mode = {}
ends = []
for key in self._map_account_ids:
@@ -364,7 +369,9 @@ class AccountingExpressionProcessor:
):
# in initial mode, ignore accounts with 0 balance
continue
- self._data[key][acc["account_id"][0]] = (debit * rate, credit * rate)
+ # due to branches, it's possible to have multiple acc
+ # with the same account_id
+ self._data[key][acc["account_id"][0]] += (debit * rate, credit * rate)
# compute ending balances by summing initial and variation
for key in ends:
domain, mode = key
diff --git a/mis_builder/static/description/index.html b/mis_builder/static/description/index.html
index ac188f1..a60fd91 100644
--- a/mis_builder/static/description/index.html
+++ b/mis_builder/static/description/index.html
@@ -367,7 +367,7 @@ ul.auto-toc {
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-!! source digest: sha256:b77109780c345283441ae799e88053caf41557f5746ecbd96ff63cb08c081d35
+!! source digest: sha256:cb9411126609016ab4d14f56da97fa22dbdecf81b69ec9e091a431a47eb27011
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
This module allows you to build Management Information Systems
@@ -383,47 +383,51 @@ to PDF, Excel and they can be added to Odoo dashboards.
Development
Known issues / Roadmap
Changelog
@@ -481,15 +485,25 @@ can be found on GitHub.
-
+
+
+
+
+- Add support for branch companies.
+(#648)
+
+
+
+
+
Bugfixes
- Restore compatibility with python 3.9
(#590)
-
-
+
+
Bugfixes
- Resolve a permission issue when creating report periods with a user
@@ -497,16 +511,16 @@ without admin rights.
(#596)
-
-
+
+
Features
- Improve UX by adding the option to edit the pivot date directly on
the view.
-
-
+
+
Features
- Migration to 16.0
@@ -546,24 +560,24 @@ enough.
(#415)
-
-
+
+
Bugfixes
- Support users without timezone.
(#388)
-
-
+
+
Bugfixes
- Allow deleting a report that has subreports.
(#431)
-
-
+
+
Bugfixes
- Fix access right issue when clicking the “Save” button on a MIS
@@ -571,8 +585,8 @@ Report Instance form.
(#410)
-
-
+
+
Features
- Remove various field size limits.
@@ -604,8 +618,8 @@ use parent_state, we now remove this argument.
-
-
+
+
Bugfixes
- When on a MIS Report Instance, if you wanted to generate a new line
@@ -617,16 +631,16 @@ record solves the problem.
(#361)
-
-
+
+
Bugfixes
- Fix drilldown action name when the account model has been customized.
(#350)
-
-
+
+
Bugfixes
- While duplicating a MIS report instance, comparison columns are
@@ -635,8 +649,8 @@ old source_cmpcol_from_id and source_cmpcol_to_id from the original
record. (#343)
-
-
+
+
Features
- The drilldown action name displayed on the breadcrumb has been
@@ -648,8 +662,8 @@ interactive view.
(#320)
-
-
+
+
Bugfixes
- Having a “Compare columns” added on a KPI with an associated style
@@ -663,8 +677,8 @@ the percentages when exporting to XLSX.
#296
-
-
+
+
Bugfixes
- The “Settings” button is now displayed for users with the “Show full
@@ -672,8 +686,8 @@ accounting features” right when previewing a report.
(#281)
-
-
+
+
Bugfixes
- Fix TypeError: 'module' object is not iterable when using budgets
@@ -681,8 +695,8 @@ by account.
(#276)
-
-
+
+
Features
- Add column-level filters on analytic account and analytic tags. These
@@ -700,12 +714,12 @@ balance_sheet.total_assets).
(#155)
-
-
+
+
Migration to odoo 13.0.
-
-
+
+
Features
- The account_id field of the model selected in ‘Move lines source’
@@ -744,8 +758,8 @@ replacing it with %.
(#220)
-
-
+
+
Features
- New year-to-date mode for defining periods.
@@ -769,8 +783,8 @@ non-multi expressions yield tuples of incorrect lenght.
(#192)
-
-
+
+
Features
Dynamic analytic filters in report preview are not yet available in 11,
this requires an update to the JS widget that proved difficult to
@@ -820,8 +834,8 @@ inherit” is checked, as for all other syle elements.
analytic filters, the underlying model must now have an
analytic_account_id field.
-
-
+
+
- [FIX] Fix bug in company_default_get call returning id instead of
recordset (#103)
@@ -830,16 +844,16 @@ that serve as basis for other formulas, but do not need to be
displayed). (#46)
-
-
+
+
- [FIX] Missing comparison operator for AccountingNone leading to
errors in pbal computations
(#93)
-
-
+
+
- [FIX] make subkpi ordering deterministic
(#71)
@@ -853,13 +867,13 @@ resp positive balances)
(#86)
-
-
+
+
Migration to Odoo 11. No new feature.
(#67)
-
-
+
+
New features:
- [ADD] month and year relative periods, easier to use than date ranges
@@ -896,24 +910,24 @@ created (not yet saved) report instances.
- Alternative move line data sources must have a company_id field.
-
-
+
+
Bug fix:
- [FIX] issue with initial balance rounding.
#30
-
-
+
+
Bug fix:
- [FIX] fix error saving KPI on newly created reports.
#18
-
-
+
+
New features:
- [ADD] Alternative move line source per report column. This makes mis
@@ -958,7 +972,7 @@ user
-
+
- [IMP] more robust behaviour in presence of missing expressions
- [FIX] indent style
@@ -970,24 +984,24 @@ generating reports with no objects
- [IMP] provide full access to mis builder style for group Adviser.
-
-
+
+
- [IMP] Add refresh button in mis report preview.
- [IMP] Widget code changes to allow to add fields in the widget more
easily.
-
-
+
+
- [IMP] remove unused argument in declare_and_compute_period() for a
cleaner API. This is a breaking API changing merged in urgency before
it is used by other modules.
-
-
+
+
Part of the work for this release has been done at the Sorrento sprint
April 26-29, 2016. The rest (ie a major refactoring) has been done in
the weeks after.
@@ -1036,8 +1050,8 @@ more flexible alternative to fiscal periods
consolidation accounts have been removed
-
-
+
-
-
+
+
Pre-history. Or rather, you need to look at the git log.
-
+
Bugs are tracked on GitHub Issues.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
@@ -1075,15 +1089,15 @@ If you spotted it first, help us to smash it by providing a detailed and welcome
Do not contact contributors directly about support or help with technical issues.
-
+
-
+
This module is maintained by the OCA.
diff --git a/mis_builder/tests/test_aep.py b/mis_builder/tests/test_aep.py
index b15fc6f..0d4368d 100644
--- a/mis_builder/tests/test_aep.py
+++ b/mis_builder/tests/test_aep.py
@@ -90,6 +90,7 @@ class TestAEP(common.TransactionCase):
self.aep.parse_expr("bali[700IN]")
self.aep.parse_expr("bale[700IN]")
self.aep.parse_expr("balp[700IN]")
+ self.aep.parse_expr("balp[700NA]") # account that does not exist
self.aep.parse_expr("bali[400AR]")
self.aep.parse_expr("bale[400AR]")
self.aep.parse_expr("balp[400AR]")
@@ -200,6 +201,8 @@ class TestAEP(common.TransactionCase):
# check ending balance
self.assertEqual(self._eval("bale[400AR]"), 400)
self.assertEqual(self._eval("bale[700IN]"), -300)
+ # check result for non existing account
+ self.assertIs(self._eval("bale[700NA]"), AccountingNone)
# let's query for March
self._do_queries(
@@ -234,9 +237,14 @@ class TestAEP(common.TransactionCase):
# unallocated p&l from previous year
self.assertEqual(self._eval("balu[]"), -100)
-
# TODO allocate profits, and then...
+ # let's query for December where there is no data
+ self._do_queries(
+ datetime.date(self.curr_year, 12, 1), datetime.date(self.curr_year, 12, 31)
+ )
+ self.assertIs(self._eval("balp[700IN]"), AccountingNone)
+
def test_aep_by_account(self):
self.aep.done_parsing()
self._do_queries(
@@ -410,3 +418,40 @@ class TestAEP(common.TransactionCase):
datetime.date(self.prev_year, 12, 1),
)
assert "Error while querying move line source" in str(cm.exception)
+
+ def test_aep_branch(self):
+ # create branch
+ self.branch = self.res_company.create(
+ {
+ "name": "AEP Branch",
+ "parent_id": self.company.id,
+ }
+ )
+ # create branch move in March this year
+ branch_move = self._create_move(
+ date=datetime.date(self.curr_year, 3, 1),
+ amount=50,
+ debit_acc=self.account_ar,
+ credit_acc=self.account_in,
+ )
+ branch_move.company_id = self.branch
+ self.aep = AEP(self.company | self.branch)
+ self.aep.parse_expr("balp[]")
+ self.aep.parse_expr("bale[]")
+ self.aep.parse_expr("bali[]")
+ self.aep.done_parsing()
+ # test variation and ending balance
+ self._do_queries(
+ datetime.date(self.curr_year, 3, 1), datetime.date(self.curr_year, 3, 31)
+ )
+ variation = self._eval_by_account_id("balp[]")
+ self.assertEqual(variation, {self.account_ar.id: 550, self.account_in.id: -550})
+ ending = self._eval_by_account_id("bale[]")
+ self.assertEqual(ending, {self.account_ar.id: 950, self.account_in.id: -850})
+ # initial balance at beginning of the next period is the ending balance
+ # of previous period
+ self._do_queries(
+ datetime.date(self.curr_year, 4, 1), datetime.date(self.curr_year, 4, 30)
+ )
+ initial = self._eval_by_account_id("bali[]")
+ self.assertEqual(initial, {self.account_ar.id: 950, self.account_in.id: -850})