From 9c61eb1d76af072e0de9593f9b9baf8ead8fc033 Mon Sep 17 00:00:00 2001 From: Flectra Community Bot Date: Wed, 28 Apr 2021 16:59:57 +0200 Subject: [PATCH] Automatic Update form OCA2FC Migrator --- .gitlab-ci.yml | 16 +- README.md | 6 +- mis_builder/README.rst | 42 +++- mis_builder/__manifest__.py | 4 +- mis_builder/i18n/mis_builder.pot | 169 +++++++++----- mis_builder/models/aep.py | 6 +- mis_builder/models/mis_report.py | 5 +- mis_builder/models/mis_report_instance.py | 51 ++++- .../report/mis_report_instance_qweb.py | 6 +- mis_builder/security/ir.model.access.csv | 1 + mis_builder/static/description/index.html | 206 ++++++++++-------- .../static/src/js/mis_report_widget.js | 44 ++++ mis_builder/tests/test_aep.py | 116 +++++----- mis_builder/tests/test_analytic_filters.py | 52 ++++- mis_builder/tests/test_data_sources.py | 2 +- mis_builder/tests/test_kpi_data.py | 1 + mis_builder/tests/test_mis_report_instance.py | 19 +- mis_builder/tests/test_multi_company_aep.py | 2 +- mis_builder/tests/test_render.py | 134 ++++++------ mis_builder/views/mis_report_instance.xml | 5 + mis_builder_budget/README.rst | 18 +- mis_builder_budget/__manifest__.py | 4 +- .../i18n/mis_builder_budget.pot | 14 +- .../models/mis_budget_abstract.py | 10 +- .../models/mis_report_instance_period.py | 6 +- .../security/mis_budget_by_account.xml | 2 +- .../security/mis_budget_by_account_item.xml | 2 +- .../static/description/index.html | 98 +++++---- mis_builder_demo/README.rst | 10 +- mis_builder_demo/__manifest__.py | 4 +- mis_builder_demo/i18n/mis_builder_demo.pot | 2 +- .../models/mis_committed_purchase.sql | 4 +- .../static/description/index.html | 6 +- 33 files changed, 672 insertions(+), 395 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 597745f..ea5d265 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -25,8 +25,6 @@ test_all_modules: - apt-get install -y p7zip-full - apt-get install -y expect-dev - su - flectra -c "mkdir ~/others" - - su - flectra -c "git clone --branch 20-fixed --depth 1 https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.com/flectra-community/reporting-engine.git ~/others/reporting-engine" - - su - flectra -c "git clone --branch 20-fixed --depth 1 https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.com/flectra-community/server-ux.git ~/others/server-ux" - sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && dpkg-reconfigure --frontend=noninteractive locales && update-locale LANG=en_US.UTF-8 - mkdir ${CI_PROJECT_DIR}/ci_data - wget -O ${CI_PROJECT_DIR}/ci_data/test_base.zip https://gitlab.com/flectra-community/devops/oca2fc/raw/master/ci_data/test_base.zip @@ -38,7 +36,7 @@ test_all_modules: - mv ${CI_PROJECT_DIR}/ci_data/filestore /opt/flectra/.local/share/filestore/test_all - chown -R flectra.flectra /opt/flectra/.local/share/filestore/test_all - su - flectra -c "/opt/flectra/flectra-bin - --addons-path ${CI_PROJECT_DIR},~/others/reporting-engine,~/others/server-ux + --addons-path ${CI_PROJECT_DIR} --db_host psql --db_port 5432 --db_user flectra @@ -64,8 +62,6 @@ test_module_mis_builder_budget: - apt-get install -y p7zip-full - apt install -y expect-dev - su - flectra -c "mkdir ~/others" - - su - flectra -c "git clone --branch 20-fixed --depth 1 https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.com/flectra-community/reporting-engine.git ~/others/reporting-engine" - - su - flectra -c "git clone --branch 20-fixed --depth 1 https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.com/flectra-community/server-ux.git ~/others/server-ux" - sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && dpkg-reconfigure --frontend=noninteractive locales && update-locale LANG=en_US.UTF-8 - mkdir ${CI_PROJECT_DIR}/ci_data - wget -O ${CI_PROJECT_DIR}/ci_data/test_base.zip https://gitlab.com/flectra-community/devops/oca2fc/raw/master/ci_data/test_base.zip @@ -77,7 +73,7 @@ test_module_mis_builder_budget: - mv ${CI_PROJECT_DIR}/ci_data/filestore /opt/flectra/.local/share/filestore/test_mis_builder_budget - chown -R flectra.flectra /opt/flectra/.local/share/filestore/test_mis_builder_budget - su - flectra -c "/opt/flectra/flectra-bin - --addons-path ${CI_PROJECT_DIR},~/others/reporting-engine,~/others/server-ux + --addons-path ${CI_PROJECT_DIR} --db_host psql --db_port 5432 --db_user flectra @@ -98,8 +94,6 @@ test_module_mis_builder_demo: - apt-get install -y p7zip-full - apt install -y expect-dev - su - flectra -c "mkdir ~/others" - - su - flectra -c "git clone --branch 20-fixed --depth 1 https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.com/flectra-community/reporting-engine.git ~/others/reporting-engine" - - su - flectra -c "git clone --branch 20-fixed --depth 1 https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.com/flectra-community/server-ux.git ~/others/server-ux" - sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && dpkg-reconfigure --frontend=noninteractive locales && update-locale LANG=en_US.UTF-8 - mkdir ${CI_PROJECT_DIR}/ci_data - wget -O ${CI_PROJECT_DIR}/ci_data/test_base.zip https://gitlab.com/flectra-community/devops/oca2fc/raw/master/ci_data/test_base.zip @@ -111,7 +105,7 @@ test_module_mis_builder_demo: - mv ${CI_PROJECT_DIR}/ci_data/filestore /opt/flectra/.local/share/filestore/test_mis_builder_demo - chown -R flectra.flectra /opt/flectra/.local/share/filestore/test_mis_builder_demo - su - flectra -c "/opt/flectra/flectra-bin - --addons-path ${CI_PROJECT_DIR},~/others/reporting-engine,~/others/server-ux + --addons-path ${CI_PROJECT_DIR} --db_host psql --db_port 5432 --db_user flectra @@ -132,8 +126,6 @@ test_module_mis_builder: - apt-get install -y p7zip-full - apt install -y expect-dev - su - flectra -c "mkdir ~/others" - - su - flectra -c "git clone --branch 20-fixed --depth 1 https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.com/flectra-community/reporting-engine.git ~/others/reporting-engine" - - su - flectra -c "git clone --branch 20-fixed --depth 1 https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.com/flectra-community/server-ux.git ~/others/server-ux" - sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && dpkg-reconfigure --frontend=noninteractive locales && update-locale LANG=en_US.UTF-8 - mkdir ${CI_PROJECT_DIR}/ci_data - wget -O ${CI_PROJECT_DIR}/ci_data/test_base.zip https://gitlab.com/flectra-community/devops/oca2fc/raw/master/ci_data/test_base.zip @@ -145,7 +137,7 @@ test_module_mis_builder: - mv ${CI_PROJECT_DIR}/ci_data/filestore /opt/flectra/.local/share/filestore/test_mis_builder - chown -R flectra.flectra /opt/flectra/.local/share/filestore/test_mis_builder - su - flectra -c "/opt/flectra/flectra-bin - --addons-path ${CI_PROJECT_DIR},~/others/reporting-engine,~/others/server-ux + --addons-path ${CI_PROJECT_DIR} --db_host psql --db_port 5432 --db_user flectra diff --git a/README.md b/README.md index d8aee4c..1875db8 100644 --- a/README.md +++ b/README.md @@ -9,8 +9,8 @@ Available addons addon | version | summary --- | --- | --- -[mis_builder_budget](mis_builder_budget/) | 2.0.3.5.0| Create budgets for MIS reports -[mis_builder_demo](mis_builder_demo/) | 2.0.3.1.2| Demo addon for MIS Builder -[mis_builder](mis_builder/) | 2.0.3.6.3| Build 'Management Information System' Reports and Dashboards +[mis_builder_budget](mis_builder_budget/) | 2.0.3.5.1| Create budgets for MIS reports +[mis_builder_demo](mis_builder_demo/) | 2.0.3.1.3| Demo addon for MIS Builder +[mis_builder](mis_builder/) | 2.0.3.6.6| Build 'Management Information System' Reports and Dashboards diff --git a/mis_builder/README.rst b/mis_builder/README.rst index 1260644..8a12d01 100644 --- a/mis_builder/README.rst +++ b/mis_builder/README.rst @@ -14,13 +14,13 @@ MIS Builder :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fmis--builder-lightgray.png?logo=github - :target: https://github.com/OCA/mis-builder/tree/13.0/mis_builder + :target: https://github.com/OCA/mis-builder/tree/14.0/mis_builder :alt: OCA/mis-builder .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/mis-builder-13-0/mis-builder-13-0-mis_builder + :target: https://translation.odoo-community.org/projects/mis-builder-14-0/mis-builder-14-0-mis_builder :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png - :target: https://runbot.odoo-community.org/runbot/248/13.0 + :target: https://runbot.odoo-community.org/runbot/248/14.0 :alt: Try me on Runbot |badge1| |badge2| |badge3| |badge4| |badge5| @@ -97,6 +97,36 @@ be found on GitHub. Changelog ========= +14.0.3.6.6 (2021-04-23) +~~~~~~~~~~~~~~~~~~~~~~~ + +**Bugfixes** + +- Fix drilldown action name when the account model has been customized. (`#350 `_) + + +14.0.3.6.5 (2021-04-23) +~~~~~~~~~~~~~~~~~~~~~~~ + +**Bugfixes** + +- While duplicating a MIS report instance, comparison columns are ignored because + they would raise an error otherwise, as they keep the old source_cmpcol_from_id + and source_cmpcol_to_id from the original record. (`#343 `_) + + +14.0.3.6.4 (2021-04-06) +~~~~~~~~~~~~~~~~~~~~~~~ + +**Features** + +- The drilldown action name displayed on the breadcrumb has been revised. + The kpi description and the account ``display_name`` are shown instead + of the kpi's technical definition. (`#304 `_) +- Add analytic group filters on report instance, periods and in the interactive + view. (`#320 `_) + + 13.0.3.6.3 (2020-08-28) ~~~~~~~~~~~~~~~~~~~~~~~ @@ -162,7 +192,7 @@ Migration to odoo 13.0. ``account.account`` model). To this end, the model to be used for Actuals move lines can be configured on the report template. It can be something else than move lines and the only constraint is that its ``account_id`` field - as a ``code`` field. (`#149 `_) + has a ``code`` field. (`#149 `_) - Add ``source_aml_model_name`` field so extension modules providing alternative data sources can more easily customize their data source. (`#214 `_) - Support analytic tag filters in the backend view and preview widget. @@ -494,7 +524,7 @@ Bug Tracker 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 smashing it by providing a detailed and welcomed -`feedback `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -554,6 +584,6 @@ Current `maintainer `__: |maintainer-sbidoul| -This module is part of the `OCA/mis-builder `_ project on GitHub. +This module is part of the `OCA/mis-builder `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. \ No newline at end of file diff --git a/mis_builder/__manifest__.py b/mis_builder/__manifest__.py index b71fde1..3bccb67 100644 --- a/mis_builder/__manifest__.py +++ b/mis_builder/__manifest__.py @@ -3,7 +3,7 @@ { "name": "MIS Builder", - "version": "2.0.3.6.3", + "version": "2.0.3.6.6", "category": "Reporting", "summary": """ Build 'Management Information System' Reports and Dashboards @@ -28,7 +28,7 @@ "report/mis_report_instance_xlsx.xml", ], "qweb": ["static/src/xml/mis_report_widget.xml"], - "installable": False, + "installable": True, "application": True, "license": "AGPL-3", "development_status": "Production/Stable", diff --git a/mis_builder/i18n/mis_builder.pot b/mis_builder/i18n/mis_builder.pot index 3131a14..9065b94 100644 --- a/mis_builder/i18n/mis_builder.pot +++ b/mis_builder/i18n/mis_builder.pot @@ -4,7 +4,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 13.0\n" +"Project-Id-Version: Odoo Server 14.0\n" "Report-Msgid-Bugs-To: \n" "Last-Translator: \n" "Language-Team: \n" @@ -23,99 +23,131 @@ msgstr "" #. module: mis_builder #: model_terms:ir.ui.view,arch_db:mis_builder.mis_report_view_kpi_form msgid "" -"AccountingNone: a null value that behaves as 0 in arithmetic " -"operations." +"\n" +" balp[('user_type_id', '=',\n" +" ref('account.\n" +" data_account_type_receivable').id)][]\n" +" \n" +" : variation of the balance of all receivable\n" +" accounts over the period." msgstr "" #. module: mis_builder #: model_terms:ir.ui.view,arch_db:mis_builder.mis_report_view_kpi_form msgid "" -"bal, crd, deb, pbal, nbal: balance, debit, credit, positive balance, " -"negative balance." +"\n" +" balp[][('tax_line_id.tag_ids', '=',\n" +" ref('l10n_be.tax_tag_56').id)]\n" +" \n" +" : balance of move lines related to tax grid\n" +" 56." msgstr "" #. module: mis_builder #: model_terms:ir.ui.view,arch_db:mis_builder.mis_report_view_kpi_form msgid "" -"bal[70]: variation of the balance of account 70 over the period (it " -"is the same as balp[70]." -msgstr "" - -#. module: mis_builder -#: model_terms:ir.ui.view,arch_db:mis_builder.mis_report_view_kpi_form -msgid "bale[1%]: balance of accounts starting with 1 at end of period." -msgstr "" - -#. module: mis_builder -#: model_terms:ir.ui.view,arch_db:mis_builder.mis_report_view_kpi_form -msgid "bali[70,60]: initial balance of accounts 70 and 60." +"\n" +" debp[55%][('journal_id.code', '=',\n" +" 'BNK1')]\n" +" \n" +" : sum of all debits on accounts 55 and\n" +" journal BNK1 during the period." msgstr "" #. module: mis_builder #: model_terms:ir.ui.view,arch_db:mis_builder.mis_report_view_kpi_form msgid "" -"balp[('user_type_id', '=', " -"ref('account.data_account_type_receivable').id)][]: variation of the " -"balance of all receivable accounts over the period." +"AccountingNone\n" +" : a null value that behaves as 0 in\n" +" arithmetic operations." msgstr "" #. module: mis_builder #: model_terms:ir.ui.view,arch_db:mis_builder.mis_report_view_kpi_form msgid "" -"balp[][('tax_line_id.tag_ids', '=', ref('l10n_be.tax_tag_56').id)]: " -"balance of move lines related to tax grid 56." +"bal, crd, deb, pbal, nbal\n" +" : balance, debit, credit, positive balance,\n" +" negative balance." msgstr "" #. module: mis_builder #: model_terms:ir.ui.view,arch_db:mis_builder.mis_report_view_kpi_form msgid "" -"balu[]: (u for unallocated) is a special expression that shows the unallocated profit/loss of previous\n" +"bal[70]\n" +" : variation of the balance of account 70\n" +" over the period (it is the same as balp[70]." +msgstr "" + +#. module: mis_builder +#: model_terms:ir.ui.view,arch_db:mis_builder.mis_report_view_kpi_form +msgid "" +"bale[1%]\n" +" : balance of accounts starting with 1 at end\n" +" of period." +msgstr "" + +#. module: mis_builder +#: model_terms:ir.ui.view,arch_db:mis_builder.mis_report_view_kpi_form +msgid "" +"bali[70,60]\n" +" : initial balance of accounts 70 and 60." +msgstr "" + +#. module: mis_builder +#: model_terms:ir.ui.view,arch_db:mis_builder.mis_report_view_kpi_form +msgid "" +"balu[]\n" +" : (u for unallocated) is a special\n" +" expression that shows the unallocated\n" +" profit/loss of previous\n" " fiscal years." msgstr "" #. module: mis_builder #: model_terms:ir.ui.view,arch_db:mis_builder.mis_report_view_kpi_form msgid "" -"crdp[40%]: sum of all credits on accounts starting with 40 during the" -" period." -msgstr "" - -#. module: mis_builder -#: model_terms:ir.ui.view,arch_db:mis_builder.mis_report_view_kpi_form -msgid "date_from, date_to: beginning and end date of the period." -msgstr "" - -#. module: mis_builder -#: model_terms:ir.ui.view,arch_db:mis_builder.mis_report_view_kpi_form -msgid "datetime, datetime, dateutil: the python modules." +"crdp[40%]\n" +" : sum of all credits on accounts starting\n" +" with 40 during the period." msgstr "" #. module: mis_builder #: model_terms:ir.ui.view,arch_db:mis_builder.mis_report_view_kpi_form msgid "" -"debp[55%][('journal_id.code', '=', 'BNK1')]: sum of all debits on " -"accounts 55 and journal BNK1 during the period." +"date_from, date_to\n" +" : beginning and end date of the period." msgstr "" #. module: mis_builder #: model_terms:ir.ui.view,arch_db:mis_builder.mis_report_view_kpi_form msgid "" -"p, i, e: respectively variation over the period, initial balance, " -"ending balance" +"datetime, datetime, dateutil\n" +" : the python modules." msgstr "" #. module: mis_builder #: model_terms:ir.ui.view,arch_db:mis_builder.mis_report_view_kpi_form msgid "" -"pbale[55%]: sum of all ending balances of accounts starting with 55 whose\n" +"p, i, e\n" +" : respectively variation over the period,\n" +" initial balance, ending balance" +msgstr "" + +#. module: mis_builder +#: model_terms:ir.ui.view,arch_db:mis_builder.mis_report_view_kpi_form +msgid "" +"pbale[55%]\n" +" : sum of all ending balances of accounts\n" +" starting with 55 whose\n" " ending balance is positive." msgstr "" #. module: mis_builder #: model_terms:ir.ui.view,arch_db:mis_builder.mis_report_view_kpi_form msgid "" -"sum, min, max, len, avg: behave as expected, very similar to the " -"python builtins." +"sum, min, max, len, avg\n" +" : behave as expected, very similar to the\n" +" python builtins." msgstr "" #. module: mis_builder @@ -191,7 +223,8 @@ msgstr "" #. module: mis_builder #: model_terms:ir.ui.view,arch_db:mis_builder.mis_report_view_kpi_form msgid "" -"Additionally following variables are available in the evaluation context:" +"Additionally following variables are available\n" +" in the evaluation context:" msgstr "" #. module: mis_builder @@ -239,6 +272,21 @@ msgstr "" msgid "Analytic Account Filter" msgstr "" +#. module: mis_builder +#. openerp-web +#: code:addons/mis_builder/static/src/js/mis_report_widget.js:0 +#: model:ir.model.fields,field_description:mis_builder.field_mis_report_instance__analytic_group_id +#: model:ir.model.fields,field_description:mis_builder.field_mis_report_instance_period__analytic_group_id +#, python-format +msgid "Analytic Account Group" +msgstr "" + +#. module: mis_builder +#: code:addons/mis_builder/models/mis_report_instance.py:0 +#, python-format +msgid "Analytic Account Group: %s" +msgstr "" + #. module: mis_builder #: code:addons/mis_builder/models/mis_report_instance.py:0 #, python-format @@ -525,6 +573,7 @@ msgstr "" #. module: mis_builder #: model:ir.model.fields,field_description:mis_builder.field_add_mis_report_instance_dashboard_wizard__display_name +#: model:ir.model.fields,field_description:mis_builder.field_ir_actions_report__display_name #: model:ir.model.fields,field_description:mis_builder.field_mis_kpi_data__display_name #: model:ir.model.fields,field_description:mis_builder.field_mis_report__display_name #: model:ir.model.fields,field_description:mis_builder.field_mis_report_instance__display_name @@ -618,8 +667,9 @@ msgstr "" #. module: mis_builder #: model_terms:ir.ui.view,arch_db:mis_builder.mis_report_view_kpi_form msgid "" -"Expressions can involve other KPI, sub KPI and query results by name (eg " -"kpi1 + kpi2, kpi2.subkpi1, query1.field1)." +"Expressions can involve other KPI, sub KPI and\n" +" query results by name (eg kpi1 + kpi2,\n" +" kpi2.subkpi1, query1.field1)." msgstr "" #. module: mis_builder @@ -656,6 +706,14 @@ msgid "" "modified in the preview." msgstr "" +#. module: mis_builder +#: model:ir.model.fields,help:mis_builder.field_mis_report_instance_period__analytic_group_id +msgid "" +"Filter column on journal entries that match this analytic account group. " +"This filter is combined with a AND with the report-level filters and cannot " +"be modified in the preview." +msgstr "" + #. module: mis_builder #: model:ir.model.fields,help:mis_builder.field_mis_report_instance_period__analytic_account_id msgid "" @@ -765,6 +823,7 @@ msgstr "" #. module: mis_builder #: model:ir.model.fields,field_description:mis_builder.field_add_mis_report_instance_dashboard_wizard__id +#: model:ir.model.fields,field_description:mis_builder.field_ir_actions_report__id #: model:ir.model.fields,field_description:mis_builder.field_mis_kpi_data__id #: model:ir.model.fields,field_description:mis_builder.field_mis_report__id #: model:ir.model.fields,field_description:mis_builder.field_mis_report_instance__id @@ -878,6 +937,7 @@ msgstr "" #. module: mis_builder #: model:ir.model.fields,field_description:mis_builder.field_add_mis_report_instance_dashboard_wizard____last_update +#: model:ir.model.fields,field_description:mis_builder.field_ir_actions_report____last_update #: model:ir.model.fields,field_description:mis_builder.field_mis_kpi_data____last_update #: model:ir.model.fields,field_description:mis_builder.field_mis_report____last_update #: model:ir.model.fields,field_description:mis_builder.field_mis_report_instance____last_update @@ -1518,21 +1578,30 @@ msgstr "" #. module: mis_builder #: model_terms:ir.ui.view,arch_db:mis_builder.mis_report_view_kpi_form msgid "" -"The account selector is a like expression on the account code (eg " -"70%, etc)." +"The\n" +" account selector\n" +" is a like expression on the account code (eg\n" +" 70%, etc)." msgstr "" #. module: mis_builder #: model_terms:ir.ui.view,arch_db:mis_builder.mis_report_view_kpi_form msgid "" -"The journal items domain is an Odoo domain filter on journal items." +"The\n" +" journal items domain\n" +" is an Odoo domain filter on journal items." msgstr "" #. module: mis_builder #: model_terms:ir.ui.view,arch_db:mis_builder.mis_report_view_kpi_form msgid "" -"The following special elements are recognized in the expressions to compute accounting data:\n" -" {bal|crd|deb|pbal|nbal}{pieu}[account selector][journal items domain]." +"The following special elements are recognized in\n" +" the expressions to compute accounting data:\n" +" \n" +" {bal|crd|deb|pbal|nbal}{pieu}[account\n" +" selector][journal items domain]\n" +" \n" +" ." msgstr "" #. module: mis_builder diff --git a/mis_builder/models/aep.py b/mis_builder/models/aep.py index 4131bf8..83995f4 100644 --- a/mis_builder/models/aep.py +++ b/mis_builder/models/aep.py @@ -1,18 +1,14 @@ # Copyright 2014 ACSONE SA/NV () # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). -import datetime import re -import time from collections import defaultdict -import dateutil - from flectra import _, fields from flectra.exceptions import UserError from flectra.models import expression from flectra.tools.float_utils import float_is_zero -from flectra.tools.safe_eval import safe_eval +from flectra.tools.safe_eval import datetime, dateutil, safe_eval, time from .accounting_none import AccountingNone diff --git a/mis_builder/models/mis_report.py b/mis_builder/models/mis_report.py index 4625e15..2a7109a 100644 --- a/mis_builder/models/mis_report.py +++ b/mis_builder/models/mis_report.py @@ -370,7 +370,7 @@ class MisReportQuery(models.Model): name = fields.Char(size=32, required=True, string="Name") model_id = fields.Many2one( - "ir.model", required=True, string="Model", ondelete="restrict" + "ir.model", required=True, string="Model", ondelete="cascade" ) field_ids = fields.Many2many( "ir.model.fields", required=True, string="Fields to fetch" @@ -391,7 +391,7 @@ class MisReportQuery(models.Model): comodel_name="ir.model.fields", required=True, domain=[("ttype", "in", ("date", "datetime"))], - ondelete="restrict", + ondelete="cascade", ) domain = fields.Char(string="Domain") report_id = fields.Many2one( @@ -461,6 +461,7 @@ class MisReport(models.Model): ], default=_default_move_lines_source, required=True, + ondelete="cascade", help="A 'move line like' model, ie having at least debit, credit, " "date, account_id and company_id fields. This model is the " "data source for column Actuals.", diff --git a/mis_builder/models/mis_report_instance.py b/mis_builder/models/mis_report_instance.py index 2758965..76bfae2 100644 --- a/mis_builder/models/mis_report_instance.py +++ b/mis_builder/models/mis_report_instance.py @@ -284,6 +284,15 @@ class MisReportInstancePeriod(models.Model): "and cannot be modified in the preview." ), ) + analytic_group_id = fields.Many2one( + comodel_name="account.analytic.group", + string="Analytic Account Group", + help=( + "Filter column on journal entries that match this analytic account " + "group. This filter is combined with a AND with the report-level " + "filters and cannot be modified in the preview." + ), + ) analytic_tag_ids = fields.Many2many( comodel_name="account.analytic.tag", string="Analytic Tags", @@ -369,11 +378,8 @@ class MisReportInstancePeriod(models.Model): if operator == "all": if not isinstance(value, list): value = [value] - many_ids = self.report_instance_id.resolve_2many_commands( - filter_name, value, ["id"] - ) - for m in many_ids: - filters.append((filter_name, "in", [m["id"]])) + for m in value: + filters.append((filter_name, "in", [m])) else: filters.append((filter_name, operator, value)) return filters @@ -403,6 +409,10 @@ class MisReportInstancePeriod(models.Model): domain.extend([("move_id.state", "=", "posted")]) if self.analytic_account_id: domain.append(("analytic_account_id", "=", self.analytic_account_id.id)) + if self.analytic_group_id: + domain.append( + ("analytic_account_id.group_id", "=", self.analytic_group_id.id) + ) for tag in self.analytic_tag_ids: domain.append(("analytic_tag_ids", "=", tag.id)) return domain @@ -459,6 +469,17 @@ class MisReportInstancePeriod(models.Model): % rec.name ) + def copy_data(self, default=None): + if self.source == SRC_CMPCOL: + # While duplicating a MIS report instance, comparison columns are + # ignored because they would raise an error, as they keep the old + # `source_cmpcol_from_id` and `source_cmpcol_to_id` from the + # original record. + return [ + False, + ] + return super().copy_data(default=default) + class MisReportInstance(models.Model): """The MIS report instance combines everything to compute @@ -539,6 +560,10 @@ class MisReportInstance(models.Model): analytic_account_id = fields.Many2one( comodel_name="account.analytic.account", string="Analytic Account" ) + analytic_group_id = fields.Many2one( + comodel_name="account.analytic.group", + string="Analytic Account Group", + ) analytic_tag_ids = fields.Many2many( comodel_name="account.analytic.tag", string="Analytic Tags" ) @@ -573,8 +598,17 @@ class MisReportInstance(models.Model): filter_descriptions.append( _("Analytic Account: %s") % analytic_account.display_name ) + analytic_group_id = filters.get("analytic_account_id.group_id", {}).get("value") + if analytic_group_id: + analytic_group = self.env["account.analytic.group"].browse( + analytic_group_id + ) + filter_descriptions.append( + _("Analytic Account Group: %s") % analytic_group.display_name + ) analytic_tag_value = filters.get("analytic_tag_ids", {}).get("value") if analytic_tag_value: + # TODO 14 we need a test to cover this analytic_tag_names = self.resolve_2many_commands( "analytic_tag_ids", analytic_tag_value, ["name"] ) @@ -659,6 +693,11 @@ class MisReportInstance(models.Model): "value": self.analytic_account_id.id, "operator": "=", } + if self.analytic_group_id: + context["mis_report_filters"]["analytic_account_id.group_id"] = { + "value": self.analytic_group_id.id, + "operator": "=", + } if self.analytic_tag_ids: context["mis_report_filters"]["analytic_tag_ids"] = { "value": self.analytic_tag_ids.ids, @@ -847,7 +886,7 @@ class MisReportInstance(models.Model): account_id = arg.get("account_id") if account_id: - account = self.env["account.account"].browse(account_id) + account = self.env[self.report_id.account_model].browse(account_id) return "{kpi} - {account} - {period}".format( kpi=kpi.description, account=account.display_name, diff --git a/mis_builder/report/mis_report_instance_qweb.py b/mis_builder/report/mis_report_instance_qweb.py index 7f949af..d385fd5 100644 --- a/mis_builder/report/mis_report_instance_qweb.py +++ b/mis_builder/report/mis_report_instance_qweb.py @@ -11,7 +11,7 @@ _logger = logging.getLogger(__name__) class Report(models.Model): _inherit = "ir.actions.report" - def render_qweb_pdf(self, res_ids=None, data=None): + def _render_qweb_pdf(self, res_ids=None, data=None): if self.report_name == "mis_builder.report_mis_report_instance": if not res_ids: res_ids = self.env.context.get("active_ids") @@ -22,7 +22,7 @@ class Report(models.Model): ) # data=None, because it was there only to force Flectra # to propagate context - return super(Report, self.with_context(context)).render_qweb_pdf( + return super(Report, self.with_context(context))._render_qweb_pdf( res_ids, data=None ) - return super(Report, self).render_qweb_pdf(res_ids, data) + return super(Report, self)._render_qweb_pdf(res_ids, data) diff --git a/mis_builder/security/ir.model.access.csv b/mis_builder/security/ir.model.access.csv index 35d5761..5a61ee7 100644 --- a/mis_builder/security/ir.model.access.csv +++ b/mis_builder/security/ir.model.access.csv @@ -19,3 +19,4 @@ manage_mis_report_subreport,access_mis_report_subreport,model_mis_report_subrepo access_mis_report_subreport,access_mis_report_subreport,model_mis_report_subreport,base.group_user,1,0,0,0 manage_mis_report_style,access_mis_report_style,model_mis_report_style,account.group_account_manager,1,1,1,1 access_mis_report_style,access_mis_report_style,model_mis_report_style,base.group_user,1,0,0,0 +access_add_to_dashboard_wizard,access_add_to_dashboard_wizard,model_add_mis_report_instance_dashboard_wizard,base.group_user,1,1,1,0 diff --git a/mis_builder/static/description/index.html b/mis_builder/static/description/index.html index 37549da..86d067e 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. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

Production/Stable License: AGPL-3 OCA/mis-builder Translate me on Weblate Try me on Runbot

+

Production/Stable License: AGPL-3 OCA/mis-builder Translate me on Weblate Try me on Runbot

This module allows you to build Management Information Systems dashboards. Such style of reports presents KPI in rows and time periods in columns. Reports mainly fetch data from account moves, but can also combine data coming @@ -376,46 +376,49 @@ can be added to Odoo dashboards.

Table of contents

-

Installation

+

Installation

Your preferred way to install addons will work with MIS Builder.

An easy way to install it with all its dependencies is using pip:

    @@ -425,7 +428,7 @@ the MIS Builder application.
-

Usage

+

Usage

To configure this module, you need to:

  • Go to Accounting > Configuration > MIS Reporting > MIS Report Templates where @@ -451,7 +454,7 @@ and export it to PDF or Excel.
-

Development

+

Development

A typical extension is to provide a mechanism to filter reports on analytic dimensions or operational units. To implement this, you can override _get_additional_move_line_filter and _get_additional_filter to further filter move lines or queries based on a user @@ -460,15 +463,42 @@ or even on mis.report.instance.period if you want different columns to show diff analytic accounts.

-

Known issues / Roadmap

+

Known issues / Roadmap

The mis_builder roadmap and known issues can be found on GitHub.

-

Changelog

+

Changelog

-

13.0.3.6.3 (2020-08-28)

+

14.0.3.6.6 (2021-04-23)

+

Bugfixes

+
    +
  • Fix drilldown action name when the account model has been customized. (#350)
  • +
+
+
+

14.0.3.6.5 (2021-04-23)

+

Bugfixes

+
    +
  • While duplicating a MIS report instance, comparison columns are ignored because +they would raise an error otherwise, as they keep the old source_cmpcol_from_id +and source_cmpcol_to_id from the original record. (#343)
  • +
+
+
+

14.0.3.6.4 (2021-04-06)

+

Features

+
    +
  • The drilldown action name displayed on the breadcrumb has been revised. +The kpi description and the account display_name are shown instead +of the kpi’s technical definition. (#304)
  • +
  • Add analytic group filters on report instance, periods and in the interactive +view. (#320)
  • +
+
+
+

13.0.3.6.3 (2020-08-28)

Bugfixes

  • Having a “Compare columns” added on a KPI with an associated style using a @@ -480,23 +510,23 @@ when exporting to XLSX. (#280, #296
-
-

13.0.3.6.2 (2020-04-22)

+
+

13.0.3.6.2 (2020-04-22)

Bugfixes

  • The “Settings” button is now displayed for users with the “Show full accounting features” right when previewing a report. (#281)
-
-

13.0.3.6.1 (2020-04-22)

+
+

13.0.3.6.1 (2020-04-22)

Bugfixes

  • Fix TypeError: 'module' object is not iterable when using budgets by account. (#276)
-
-

13.0.3.6.0 (2020-03-28)

+
+

13.0.3.6.0 (2020-03-28)

Features

  • Add column-level filters on analytic account and analytic tags. @@ -511,12 +541,12 @@ Sheet” to create new KPI’s for the ratios (e.g. balance_sheet.current_assets balance_sheet.total_assets). (#155)
-
-

13.0.3.5.0 (2020-01-??)

+
+

13.0.3.5.0 (2020-01-??)

Migration to odoo 13.0.

-
-

12.0.3.5.0 (2019-10-26)

+
+

12.0.3.5.0 (2019-10-26)

Features

  • The account_id field of the model selected in ‘Move lines source’ @@ -525,7 +555,7 @@ relationship with any model that has a code fi account.account model). To this end, the model to be used for Actuals move lines can be configured on the report template. It can be something else than move lines and the only constraint is that its account_id field -as a code field. (#149)
  • +has a code field. (#149)
  • Add source_aml_model_name field so extension modules providing alternative data sources can more easily customize their data source. (#214)
  • Support analytic tag filters in the backend view and preview widget. @@ -546,8 +576,8 @@ style. (#220)
-
-

12.0.3.4.0 (2019-07-09)

+
+

12.0.3.4.0 (2019-07-09)

Features

  • New year-to-date mode for defining periods. (#165)
  • @@ -565,8 +595,8 @@ non-multi expressions yield tuples of incorrect lenght. (#192)
-
-

12.0.3.3.0 (2019-01-26)

+
+

12.0.3.3.0 (2019-01-26)

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 implement @@ -606,8 +636,8 @@ is checked, as for all other syle elements. (#121 <https://github.com/O

If you use Actuals (alternative) data source in combination with analytic filters, the underlying model must now have an analytic_account_id field.

-
-

11.0.3.2.2 (2018-06-30)

+
+

11.0.3.2.2 (2018-06-30)

  • [FIX] Fix bug in company_default_get call returning id instead of recordset @@ -618,16 +648,16 @@ need to be displayed). (#46)
-
-

11.0.3.2.1 (2018-05-29)

+
+

11.0.3.2.1 (2018-05-29)

  • [FIX] Missing comparison operator for AccountingNone leading to errors in pbal computations (#93)
-
-

10.0.3.2.0 (2018-05-02)

+
+

10.0.3.2.0 (2018-05-02)

  • [FIX] make subkpi ordering deterministic (#71)
  • @@ -641,13 +671,13 @@ resp positive balances) (#86)
-
-

11.0.3.1.2 (2018-02-04)

+
+

11.0.3.1.2 (2018-02-04)

Migration to Odoo 11. No new feature. (#67)

-
-

10.0.3.1.1 (2017-11-14)

+
+

10.0.3.1.1 (2017-11-14)

New features:

  • [ADD] month and year relative periods, easier to use than @@ -684,24 +714,24 @@ created (not yet saved) report instances.
  • Alternative move line data sources must have a company_id field.
-
-

10.0.3.0.4 (2017-10-14)

+
+

10.0.3.0.4 (2017-10-14)

Bug fix:

  • [FIX] issue with initial balance rounding. #30
-
-

10.0.3.0.3 (2017-10-03)

+
+

10.0.3.0.3 (2017-10-03)

Bug fix:

  • [FIX] fix error saving KPI on newly created reports. #18
-
-

10.0.3.0.2 (2017-10-01)

+
+

10.0.3.0.2 (2017-10-01)

New features:

  • [ADD] Alternative move line source per report column. @@ -745,7 +775,7 @@ expressions were used in a KPI
-

10.0.2.0.3 (unreleased)

+

10.0.2.0.3 (unreleased)

  • [IMP] more robust behaviour in presence of missing expressions
  • [FIX] indent style
  • @@ -757,23 +787,23 @@ reports with no objects
  • [IMP] provide full access to mis builder style for group Adviser.
-
-

9.0.2.0.2 (2016-09-27)

+
+

9.0.2.0.2 (2016-09-27)

  • [IMP] Add refresh button in mis report preview.
  • [IMP] Widget code changes to allow to add fields in the widget more easily.
-
-

9.0.2.0.1 (2016-05-26)

+
+

9.0.2.0.1 (2016-05-26)

  • [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.
-
-

9.0.2.0.0 (2016-05-24)

+
+

9.0.2.0.0 (2016-05-24)

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.

@@ -820,8 +850,8 @@ flexible alternative to fiscal periods consolidation accounts have been removed
-
-

8.0.1.0.0 (2016-04-27)

+
+

8.0.1.0.0 (2016-04-27)

-
-

8.0.0.2.0

+
+

8.0.0.2.0

Pre-history. Or rather, you need to look at the git log.

-

Bug Tracker

+

Bug Tracker

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 smashing it by providing a detailed and welcomed -feedback.

+feedback.

Do not contact contributors directly about support or help with technical issues.

-

Credits

+

Credits

-

Authors

+

Authors

  • ACSONE SA/NV
-

Contributors

+

Contributors

-

Maintainers

+

Maintainers

This module is maintained by the OCA.

Odoo Community Association

OCA, or the Odoo Community Association, is a nonprofit organization whose @@ -903,7 +933,7 @@ mission is to support the collaborative development of Odoo features and promote its widespread use.

Current maintainer:

sbidoul

-

This module is part of the OCA/mis-builder project on GitHub.

+

This module is part of the OCA/mis-builder project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

diff --git a/mis_builder/static/src/js/mis_report_widget.js b/mis_builder/static/src/js/mis_report_widget.js index b956402..2ab255f 100644 --- a/mis_builder/static/src/js/mis_report_widget.js +++ b/mis_builder/static/src/js/mis_report_widget.js @@ -34,6 +34,10 @@ flectra.define("mis_builder.widget", function (require) { self.analytic_account_id_domain = []; // TODO unused for now self.analytic_account_id_label = _t("Analytic Account Filter"); self.analytic_account_id_m2o = undefined; // Field widget + self.analytic_group_id_domain = []; // TODO unused for now + self.analytic_group_filter_name = "analytic_account_id.group_id"; + self.analytic_group_id_label = _t("Analytic Account Group"); + self.analytic_group_id_m2o = undefined; // Field widget self.analytic_tag_ids_domain = []; // TODO unused for now self.analytic_tag_ids_label = _t("Analytic Tags Filter"); self.analytic_tag_ids_m2m = undefined; // Field widget @@ -174,6 +178,12 @@ flectra.define("mis_builder.widget", function (require) { name: "filter_analytic_account_id", value: self._getFilterValue("analytic_account_id"), }); + fields.push({ + relation: "account.analytic.group", + type: "many2one", + name: "filter_analytic_account_id.group_id", + value: self._getFilterValue("analytic_account_id.group_id"), + }); } if (self.has_group_analytic_tags) { fields.push({ @@ -226,6 +236,28 @@ flectra.define("mis_builder.widget", function (require) { self.analytic_account_id_m2o ); self.analytic_account_id_m2o.appendTo(self.getMisBuilderFilterBox()); + + self.analytic_group_id_m2o = new relational_fields.FieldMany2One( + self, + "filter_analytic_account_id.group_id", + record, + { + mode: "edit", + attrs: { + placeholder: self.analytic_group_id_label, + options: { + no_create: "True", + no_open: "True", + }, + }, + } + ); + self._registerWidget( + record.id, + self.analytic_group_id_m2o.name, + self.analytic_group_id_m2o + ); + self.analytic_group_id_m2o.appendTo(self.getMisBuilderFilterBox()); } if (self.has_group_analytic_tags) { @@ -319,6 +351,18 @@ flectra.define("mis_builder.widget", function (require) { } } + if (self.analytic_group_id_m2o !== undefined) { + if (self.analytic_group_id_m2o.value) { + self._setFilterValue( + self.analytic_group_filter_name, + self.analytic_group_id_m2o.value.res_id, + "=" + ); + } else { + self._setFilterValue(self.analytic_group_filter_name, undefined); + } + } + if (self.analytic_tag_ids_m2m !== undefined) { if ( self.analytic_tag_ids_m2m.value && diff --git a/mis_builder/tests/test_aep.py b/mis_builder/tests/test_aep.py index ffd85f4..add3b06 100644 --- a/mis_builder/tests/test_aep.py +++ b/mis_builder/tests/test_aep.py @@ -125,7 +125,7 @@ class TestAEP(common.TransactionCase): } ) if post: - move.post() + move._post() return move def _do_queries(self, date_from, date_to): @@ -147,8 +147,8 @@ class TestAEP(common.TransactionCase): return res def test_sanity_check(self): - self.assertEquals(self.company.fiscalyear_last_day, 31) - self.assertEquals(self.company.fiscalyear_last_month, "12") + self.assertEqual(self.company.fiscalyear_last_day, 31) + self.assertEqual(self.company.fiscalyear_last_month, "12") def test_aep_basic(self): self.aep.done_parsing() @@ -160,9 +160,9 @@ class TestAEP(common.TransactionCase): self.assertIs(self._eval("bali[400AR]"), AccountingNone) self.assertIs(self._eval("bali[700IN]"), AccountingNone) # check variation - self.assertEquals(self._eval("balp[400AR]"), 100) - self.assertEquals(self._eval("balp[][('account_id.code', '=', '400AR')]"), 100) - self.assertEquals( + self.assertEqual(self._eval("balp[400AR]"), 100) + self.assertEqual(self._eval("balp[][('account_id.code', '=', '400AR')]"), 100) + self.assertEqual( self._eval( "balp[]" "[('account_id.user_type_id', '=', " @@ -170,14 +170,14 @@ class TestAEP(common.TransactionCase): ), 100, ) - self.assertEquals( + self.assertEqual( self._eval( "balp[('user_type_id', '=', " " ref('account.data_account_type_receivable').id)]" ), 100, ) - self.assertEquals( + self.assertEqual( self._eval( "balp['&', " " ('user_type_id', '=', " @@ -186,58 +186,58 @@ class TestAEP(common.TransactionCase): ), 100, ) - self.assertEquals(self._eval("balp[700IN]"), -100) + self.assertEqual(self._eval("balp[700IN]"), -100) # check ending balance - self.assertEquals(self._eval("bale[400AR]"), 100) - self.assertEquals(self._eval("bale[700IN]"), -100) + self.assertEqual(self._eval("bale[400AR]"), 100) + self.assertEqual(self._eval("bale[700IN]"), -100) # let's query for January self._do_queries( datetime.date(self.curr_year, 1, 1), datetime.date(self.curr_year, 1, 31) ) # initial balance is None for income account (it's not carried over) - self.assertEquals(self._eval("bali[400AR]"), 100) + self.assertEqual(self._eval("bali[400AR]"), 100) self.assertIs(self._eval("bali[700IN]"), AccountingNone) # check variation - self.assertEquals(self._eval("balp[400AR]"), 300) - self.assertEquals(self._eval("balp[700IN]"), -300) + self.assertEqual(self._eval("balp[400AR]"), 300) + self.assertEqual(self._eval("balp[700IN]"), -300) # check ending balance - self.assertEquals(self._eval("bale[400AR]"), 400) - self.assertEquals(self._eval("bale[700IN]"), -300) + self.assertEqual(self._eval("bale[400AR]"), 400) + self.assertEqual(self._eval("bale[700IN]"), -300) # let's query for March self._do_queries( datetime.date(self.curr_year, 3, 1), datetime.date(self.curr_year, 3, 31) ) # initial balance is the ending balance fo January - self.assertEquals(self._eval("bali[400AR]"), 400) - self.assertEquals(self._eval("bali[700IN]"), -300) - self.assertEquals(self._eval("pbali[400AR]"), 400) - self.assertEquals(self._eval("nbali[400AR]"), 0) - self.assertEquals(self._eval("nbali[700IN]"), -300) - self.assertEquals(self._eval("pbali[700IN]"), 0) + self.assertEqual(self._eval("bali[400AR]"), 400) + self.assertEqual(self._eval("bali[700IN]"), -300) + self.assertEqual(self._eval("pbali[400AR]"), 400) + self.assertEqual(self._eval("nbali[400AR]"), 0) + self.assertEqual(self._eval("nbali[700IN]"), -300) + self.assertEqual(self._eval("pbali[700IN]"), 0) # check variation - self.assertEquals(self._eval("balp[400AR]"), 500) - self.assertEquals(self._eval("balp[700IN]"), -500) - self.assertEquals(self._eval("nbalp[400AR]"), 0) - self.assertEquals(self._eval("pbalp[400AR]"), 500) - self.assertEquals(self._eval("nbalp[700IN]"), -500) - self.assertEquals(self._eval("pbalp[700IN]"), 0) + self.assertEqual(self._eval("balp[400AR]"), 500) + self.assertEqual(self._eval("balp[700IN]"), -500) + self.assertEqual(self._eval("nbalp[400AR]"), 0) + self.assertEqual(self._eval("pbalp[400AR]"), 500) + self.assertEqual(self._eval("nbalp[700IN]"), -500) + self.assertEqual(self._eval("pbalp[700IN]"), 0) # check ending balance - self.assertEquals(self._eval("bale[400AR]"), 900) - self.assertEquals(self._eval("nbale[400AR]"), 0) - self.assertEquals(self._eval("pbale[400AR]"), 900) - self.assertEquals(self._eval("bale[700IN]"), -800) - self.assertEquals(self._eval("nbale[700IN]"), -800) - self.assertEquals(self._eval("pbale[700IN]"), 0) + self.assertEqual(self._eval("bale[400AR]"), 900) + self.assertEqual(self._eval("nbale[400AR]"), 0) + self.assertEqual(self._eval("pbale[400AR]"), 900) + self.assertEqual(self._eval("bale[700IN]"), -800) + self.assertEqual(self._eval("nbale[700IN]"), -800) + self.assertEqual(self._eval("pbale[700IN]"), 0) # check some variant expressions, for coverage - self.assertEquals(self._eval("crdp[700I%]"), 500) - self.assertEquals(self._eval("debp[400A%]"), 500) - self.assertEquals(self._eval("bal_700IN"), -500) - self.assertEquals(self._eval("bals[700IN]"), -800) + self.assertEqual(self._eval("crdp[700I%]"), 500) + self.assertEqual(self._eval("debp[400A%]"), 500) + self.assertEqual(self._eval("bal_700IN"), -500) + self.assertEqual(self._eval("bals[700IN]"), -800) # unallocated p&l from previous year - self.assertEquals(self._eval("balu[]"), -100) + self.assertEqual(self._eval("balu[]"), -100) # TODO allocate profits, and then... @@ -247,31 +247,27 @@ class TestAEP(common.TransactionCase): datetime.date(self.curr_year, 3, 1), datetime.date(self.curr_year, 3, 31) ) variation = self._eval_by_account_id("balp[]") - self.assertEquals( - variation, {self.account_ar.id: 500, self.account_in.id: -500} - ) + self.assertEqual(variation, {self.account_ar.id: 500, self.account_in.id: -500}) variation = self._eval_by_account_id("pbalp[]") - self.assertEquals( + self.assertEqual( variation, {self.account_ar.id: 500, self.account_in.id: AccountingNone} ) variation = self._eval_by_account_id("nbalp[]") - self.assertEquals( + self.assertEqual( variation, {self.account_ar.id: AccountingNone, self.account_in.id: -500} ) variation = self._eval_by_account_id("balp[700IN]") - self.assertEquals(variation, {self.account_in.id: -500}) + self.assertEqual(variation, {self.account_in.id: -500}) variation = self._eval_by_account_id("crdp[700IN] - debp[400AR]") - self.assertEquals( - variation, {self.account_ar.id: -500, self.account_in.id: 500} - ) + self.assertEqual(variation, {self.account_ar.id: -500, self.account_in.id: 500}) end = self._eval_by_account_id("bale[]") - self.assertEquals(end, {self.account_ar.id: 900, self.account_in.id: -800}) + self.assertEqual(end, {self.account_ar.id: 900, self.account_in.id: -800}) def test_aep_convenience_methods(self): initial = AEP.get_balances_initial( self.company, time.strftime("%Y") + "-03-01", "posted" ) - self.assertEquals( + self.assertEqual( initial, {self.account_ar.id: (400, 0), self.account_in.id: (0, 300)} ) variation = AEP.get_balances_variation( @@ -280,19 +276,19 @@ class TestAEP(common.TransactionCase): time.strftime("%Y") + "-03-31", "posted", ) - self.assertEquals( + self.assertEqual( variation, {self.account_ar.id: (500, 0), self.account_in.id: (0, 500)} ) end = AEP.get_balances_end( self.company, time.strftime("%Y") + "-03-31", "posted" ) - self.assertEquals( + self.assertEqual( end, {self.account_ar.id: (900, 0), self.account_in.id: (0, 800)} ) unallocated = AEP.get_unallocated_pl( self.company, time.strftime("%Y") + "-03-15", "posted" ) - self.assertEquals(unallocated, (0, 100)) + self.assertEqual(unallocated, (0, 100)) def test_float_is_zero(self): dp = self.company.currency_id.decimal_places @@ -307,7 +303,7 @@ class TestAEP(common.TransactionCase): initial = AEP.get_balances_initial( self.company, time.strftime("%Y") + "-01-01", "posted" ) - self.assertEquals(initial, {self.account_ar.id: (100.00, 100.01)}) + self.assertEqual(initial, {self.account_ar.id: (100.00, 100.01)}) # make initial balance at Jan 1st equal to 0.001 self._create_move( date=datetime.date(self.prev_year, 12, 1), @@ -319,19 +315,19 @@ class TestAEP(common.TransactionCase): self.company, time.strftime("%Y") + "-01-01", "posted" ) # epsilon initial balances is reported as empty - self.assertEquals(initial, {}) + self.assertEqual(initial, {}) def test_get_account_ids_for_expr(self): self.aep.done_parsing() expr = "balp[700IN]" account_ids = self.aep.get_account_ids_for_expr(expr) - self.assertEquals(account_ids, {self.account_in.id}) + self.assertEqual(account_ids, {self.account_in.id}) expr = "balp[700%]" account_ids = self.aep.get_account_ids_for_expr(expr) - self.assertEquals(account_ids, {self.account_in.id}) + self.assertEqual(account_ids, {self.account_in.id}) expr = "bali[400%], bale[700%]" # subkpis combined expression account_ids = self.aep.get_account_ids_for_expr(expr) - self.assertEquals(account_ids, {self.account_in.id, self.account_ar.id}) + self.assertEqual(account_ids, {self.account_in.id, self.account_ar.id}) def test_get_aml_domain_for_expr(self): self.aep.done_parsing() @@ -394,7 +390,7 @@ class TestAEP(common.TransactionCase): self.aep.done_parsing() tax = self.env["account.tax"].create( - dict(name="test tax", active=True, amount=0) + dict(name="test tax", active=True, amount=0, company_id=self.company.id) ) move = self._create_move( date=datetime.date(self.prev_year, 12, 1), @@ -407,7 +403,7 @@ class TestAEP(common.TransactionCase): if ml.credit: ml.write(dict(tax_ids=[(6, 0, [tax.id])])) tax.active = False - move.post() + move._post() # let's query for december 1st self._do_queries( datetime.date(self.prev_year, 12, 1), datetime.date(self.prev_year, 12, 1) diff --git a/mis_builder/tests/test_analytic_filters.py b/mis_builder/tests/test_analytic_filters.py index 246bd25..b88c2ca 100644 --- a/mis_builder/tests/test_analytic_filters.py +++ b/mis_builder/tests/test_analytic_filters.py @@ -5,14 +5,21 @@ from flectra.tests.common import TransactionCase class TestAnalyticFilters(TransactionCase): + def setUp(self): + super(TestAnalyticFilters, self).setUp() + self.aag = self.env["account.analytic.group"].search([], limit=1) + def test_context_with_filters(self): aaa = self.env["account.analytic.account"].search([], limit=1) mri = self.env["mis.report.instance"].new() mri.analytic_account_id = False + mri.analytic_group_id = False assert mri._context_with_filters().get("mis_report_filters") == {} mri.analytic_account_id = aaa + mri.analytic_group_id = self.aag assert mri._context_with_filters().get("mis_report_filters") == { - "analytic_account_id": {"value": aaa.id, "operator": "="} + "analytic_account_id": {"value": aaa.id, "operator": "="}, + "analytic_account_id.group_id": {"value": self.aag.id, "operator": "="}, } # test _context_with_filters does nothing is a filter is already # in the context @@ -30,6 +37,16 @@ class TestAnalyticFilters(TransactionCase): ) assert domain == expected_domain + def _check_get_filter_descriptions_from_context( + self, mis_report_filters, expected_domain + ): + filter_descriptions = ( + self.env["mis.report.instance"] + .with_context(mis_report_filters=mis_report_filters) + .get_filter_descriptions_from_context() + ) + assert filter_descriptions == expected_domain + def test_get_filter_domain_from_context_1(self): # no filter, no domain self._check_get_filter_domain_from_context({}, []) @@ -37,11 +54,18 @@ class TestAnalyticFilters(TransactionCase): self._check_get_filter_domain_from_context( {"analytic_account_id": {"value": 1}}, [("analytic_account_id", "=", 1)] ) + self._check_get_filter_domain_from_context( + {"analytic_group_id": {"value": 1}}, [("analytic_group_id", "=", 1)] + ) # custom operator self._check_get_filter_domain_from_context( {"analytic_account_id": {"value": 1, "operator": "!="}}, [("analytic_account_id", "!=", 1)], ) + self._check_get_filter_domain_from_context( + {"analytic_group_id": {"value": 1, "operator": "!="}}, + [("analytic_group_id", "!=", 1)], + ) # any field name works self._check_get_filter_domain_from_context( {"some_field": {"value": "x"}}, [("some_field", "=", "x")] @@ -53,13 +77,39 @@ class TestAnalyticFilters(TransactionCase): {"analytic_account_id": {"value": False}}, [("analytic_account_id", "=", False)], ) + self._check_get_filter_domain_from_context( + {"analytic_group_id": {"value": False}}, + [("analytic_group_id", "=", False)], + ) # Filter from analytic account filter widget self._check_get_filter_domain_from_context( {"analytic_account_id": {"value": 1, "operator": "all"}}, [("analytic_account_id", "in", [1])], ) + + # Filter from analytic group filter widget + self._check_get_filter_domain_from_context( + {"analytic_group_id": {"value": 1, "operator": "all"}}, + [("analytic_group_id", "in", [1])], + ) + # Filter from analytic tags filter widget self._check_get_filter_domain_from_context( {"analytic_tag_ids": {"value": [1, 2], "operator": "all"}}, [("analytic_tag_ids", "in", [1]), ("analytic_tag_ids", "in", [2])], ) + + def test_get_filter_descriptions_from_context_1(self): + self._check_get_filter_descriptions_from_context( + {"analytic_account_id.group_id": {"value": self.aag.id}}, + ["Analytic Account Group: %s" % self.aag.display_name], + ) + + def test_get_additional_move_line_filter_with_analytic_group(self): + instance_period = self.env["mis.report.instance.period"].new( + { + "analytic_group_id": self.aag.id, + } + ) + domain = instance_period._get_additional_move_line_filter() + assert domain == [("analytic_account_id.group_id", "=", self.aag.id)] diff --git a/mis_builder/tests/test_data_sources.py b/mis_builder/tests/test_data_sources.py index 3aeb769..66f98d9 100644 --- a/mis_builder/tests/test_data_sources.py +++ b/mis_builder/tests/test_data_sources.py @@ -32,7 +32,7 @@ class TestMisReportInstanceDataSources(common.TransactionCase): ], } ) - move.post() + move._post() return move def setUp(self): diff --git a/mis_builder/tests/test_kpi_data.py b/mis_builder/tests/test_kpi_data.py index 37766f1..cef731c 100644 --- a/mis_builder/tests/test_kpi_data.py +++ b/mis_builder/tests/test_kpi_data.py @@ -13,6 +13,7 @@ class TestKpiData(SavepointCase): _name = "mis.kpi.data.test.item" _inherit = "mis.kpi.data" + _description = "MIS Kpi Data test item" @classmethod def setUpClass(cls): diff --git a/mis_builder/tests/test_mis_report_instance.py b/mis_builder/tests/test_mis_report_instance.py index 9121cdd..2c8a4a1 100644 --- a/mis_builder/tests/test_mis_report_instance.py +++ b/mis_builder/tests/test_mis_report_instance.py @@ -314,9 +314,6 @@ class TestMisReportInstance(common.HttpCase): ], ) ) - self.report_instance.period_ids[1].comparison_column_ids = [ - (4, self.report_instance.period_ids[0].id, None) - ] # same for report 2 self.report_instance_2 = self.env["mis.report.instance"].create( dict( @@ -364,13 +361,13 @@ class TestMisReportInstance(common.HttpCase): vals = [c.val for c in row.iter_cells()] if row.kpi.name == "k3": # k3 is constant - self.assertEquals(vals, [AccountingNone, AccountingNone, 1.0]) + self.assertEqual(vals, [AccountingNone, AccountingNone, 1.0]) elif row.kpi.name == "k6": # k6 is a string kpi - self.assertEquals(vals, ["bla", "bla", "blabla"]) + self.assertEqual(vals, ["bla", "bla", "blabla"]) elif row.kpi.name == "k7": # k7 references k3 via subkpi names - self.assertEquals(vals, [AccountingNone, AccountingNone, 1.0]) + self.assertEqual(vals, [AccountingNone, AccountingNone, 1.0]) def test_multi_company_compute(self): self.report_instance.write( @@ -474,7 +471,7 @@ class TestMisReportInstance(common.HttpCase): res = self.report.get_kpis_by_account_id(self.env.ref("base.main_company")) for account_id in account_ids: self.assertTrue(account_id in res) - self.assertEquals(res[account_id], kpi200) + self.assertEqual(res[account_id], kpi200) def test_kpi_name_get_name_search(self): r = self.env["mis.report.kpi"].name_search("k1") @@ -539,13 +536,11 @@ class TestMisReportInstance(common.HttpCase): for row in matrix.iter_rows(): vals = [c.val for c in row.iter_cells()] if row.kpi.name == "k1": - self.assertEquals( - vals, [AccountingNone, AccountingNone, AccountingNone] - ) + self.assertEqual(vals, [AccountingNone, AccountingNone, AccountingNone]) elif row.kpi.name == "k2": - self.assertEquals(vals, [AccountingNone, AccountingNone, None]) + self.assertEqual(vals, [AccountingNone, AccountingNone, None]) elif row.kpi.name == "k4": - self.assertEquals(vals, [AccountingNone, AccountingNone, 1.0]) + self.assertEqual(vals, [AccountingNone, AccountingNone, 1.0]) def test_raise_when_unknown_kpi_value_type(self): with self.assertRaises(SubKPIUnknownTypeError): diff --git a/mis_builder/tests/test_multi_company_aep.py b/mis_builder/tests/test_multi_company_aep.py index 6de549f..39c7969 100644 --- a/mis_builder/tests/test_multi_company_aep.py +++ b/mis_builder/tests/test_multi_company_aep.py @@ -115,7 +115,7 @@ class TestMultiCompanyAEP(common.TransactionCase): ], } ) - move.post() + move._post() return move def _do_queries(self, companies, currency, date_from, date_to): diff --git a/mis_builder/tests/test_render.py b/mis_builder/tests/test_render.py index d6bb50b..af2ae26 100644 --- a/mis_builder/tests/test_render.py +++ b/mis_builder/tests/test_render.py @@ -37,149 +37,145 @@ class TestRendering(common.TransactionCase): return r def test_render(self): - self.assertEquals(u"1", self._render(1)) - self.assertEquals(u"1", self._render(1.1)) - self.assertEquals(u"2", self._render(1.6)) + self.assertEqual(u"1", self._render(1)) + self.assertEqual(u"1", self._render(1.1)) + self.assertEqual(u"2", self._render(1.6)) self.style.dp_inherit = False self.style.dp = 2 - self.assertEquals(u"1.00", self._render(1)) - self.assertEquals(u"1.10", self._render(1.1)) - self.assertEquals(u"1.60", self._render(1.6)) - self.assertEquals(u"1.61", self._render(1.606)) - self.assertEquals(u"12,345.67", self._render(12345.67)) + self.assertEqual(u"1.00", self._render(1)) + self.assertEqual(u"1.10", self._render(1.1)) + self.assertEqual(u"1.60", self._render(1.6)) + self.assertEqual(u"1.61", self._render(1.606)) + self.assertEqual(u"12,345.67", self._render(12345.67)) def test_render_negative(self): # non breaking hyphen - self.assertEquals(u"\u20111", self._render(-1)) + self.assertEqual(u"\u20111", self._render(-1)) def test_render_zero(self): - self.assertEquals(u"0", self._render(0)) - self.assertEquals(u"", self._render(None)) - self.assertEquals(u"", self._render(AccountingNone)) + self.assertEqual(u"0", self._render(0)) + self.assertEqual(u"", self._render(None)) + self.assertEqual(u"", self._render(AccountingNone)) def test_render_suffix(self): self.style.suffix_inherit = False self.style.suffix = u"€" - self.assertEquals(u"1\xa0€", self._render(1)) + self.assertEqual(u"1\xa0€", self._render(1)) self.style.suffix = u"k€" self.style.divider_inherit = False self.style.divider = "1e3" - self.assertEquals(u"1\xa0k€", self._render(1000)) + self.assertEqual(u"1\xa0k€", self._render(1000)) def test_render_prefix(self): self.style.prefix_inherit = False self.style.prefix = u"$" - self.assertEquals(u"$\xa01", self._render(1)) + self.assertEqual(u"$\xa01", self._render(1)) self.style.prefix = u"k$" self.style.divider_inherit = False self.style.divider = "1e3" - self.assertEquals(u"k$\xa01", self._render(1000)) + self.assertEqual(u"k$\xa01", self._render(1000)) def test_render_divider(self): self.style.divider_inherit = False self.style.divider = "1e3" self.style.dp_inherit = False self.style.dp = 0 - self.assertEquals(u"1", self._render(1000)) + self.assertEqual(u"1", self._render(1000)) self.style.divider = "1e6" self.style.dp = 3 - self.assertEquals(u"0.001", self._render(1000)) + self.assertEqual(u"0.001", self._render(1000)) self.style.divider = "1e-3" self.style.dp = 0 - self.assertEquals(u"1,000", self._render(1)) + self.assertEqual(u"1,000", self._render(1)) self.style.divider = "1e-6" self.style.dp = 0 - self.assertEquals(u"1,000,000", self._render(1)) + self.assertEqual(u"1,000,000", self._render(1)) def test_render_pct(self): - self.assertEquals(u"100\xa0%", self._render(1, TYPE_PCT)) - self.assertEquals(u"50\xa0%", self._render(0.5, TYPE_PCT)) + self.assertEqual(u"100\xa0%", self._render(1, TYPE_PCT)) + self.assertEqual(u"50\xa0%", self._render(0.5, TYPE_PCT)) self.style.dp_inherit = False self.style.dp = 2 - self.assertEquals(u"51.23\xa0%", self._render(0.5123, TYPE_PCT)) + self.assertEqual(u"51.23\xa0%", self._render(0.5123, TYPE_PCT)) def test_render_string(self): - self.assertEquals(u"", self._render("", TYPE_STR)) - self.assertEquals(u"", self._render(None, TYPE_STR)) - self.assertEquals(u"abcdé", self._render(u"abcdé", TYPE_STR)) + self.assertEqual(u"", self._render("", TYPE_STR)) + self.assertEqual(u"", self._render(None, TYPE_STR)) + self.assertEqual(u"abcdé", self._render(u"abcdé", TYPE_STR)) def test_compare_num_pct(self): - self.assertEquals((1.0, u"+100.0\xa0%"), self._compare_and_render(100, 50)) - self.assertEquals((0.5, u"+50.0\xa0%"), self._compare_and_render(75, 50)) - self.assertEquals((0.5, u"+50.0\xa0%"), self._compare_and_render(-25, -50)) - self.assertEquals((1.0, u"+100.0\xa0%"), self._compare_and_render(0, -50)) - self.assertEquals((2.0, u"+200.0\xa0%"), self._compare_and_render(50, -50)) - self.assertEquals((-0.5, u"\u201150.0\xa0%"), self._compare_and_render(25, 50)) - self.assertEquals((-1.0, u"\u2011100.0\xa0%"), self._compare_and_render(0, 50)) - self.assertEquals( - (-2.0, u"\u2011200.0\xa0%"), self._compare_and_render(-50, 50) - ) - self.assertEquals( - (-0.5, u"\u201150.0\xa0%"), self._compare_and_render(-75, -50) - ) - self.assertEquals( + self.assertEqual((1.0, u"+100.0\xa0%"), self._compare_and_render(100, 50)) + self.assertEqual((0.5, u"+50.0\xa0%"), self._compare_and_render(75, 50)) + self.assertEqual((0.5, u"+50.0\xa0%"), self._compare_and_render(-25, -50)) + self.assertEqual((1.0, u"+100.0\xa0%"), self._compare_and_render(0, -50)) + self.assertEqual((2.0, u"+200.0\xa0%"), self._compare_and_render(50, -50)) + self.assertEqual((-0.5, u"\u201150.0\xa0%"), self._compare_and_render(25, 50)) + self.assertEqual((-1.0, u"\u2011100.0\xa0%"), self._compare_and_render(0, 50)) + self.assertEqual((-2.0, u"\u2011200.0\xa0%"), self._compare_and_render(-50, 50)) + self.assertEqual((-0.5, u"\u201150.0\xa0%"), self._compare_and_render(-75, -50)) + self.assertEqual( (AccountingNone, u""), self._compare_and_render(50, AccountingNone) ) - self.assertEquals((AccountingNone, u""), self._compare_and_render(50, None)) - self.assertEquals((AccountingNone, u""), self._compare_and_render(50, 50)) - self.assertEquals((0.002, u"+0.2\xa0%"), self._compare_and_render(50.1, 50)) - self.assertEquals((AccountingNone, u""), self._compare_and_render(50.01, 50)) - self.assertEquals( + self.assertEqual((AccountingNone, u""), self._compare_and_render(50, None)) + self.assertEqual((AccountingNone, u""), self._compare_and_render(50, 50)) + self.assertEqual((0.002, u"+0.2\xa0%"), self._compare_and_render(50.1, 50)) + self.assertEqual((AccountingNone, u""), self._compare_and_render(50.01, 50)) + self.assertEqual( (-1.0, u"\u2011100.0\xa0%"), self._compare_and_render(AccountingNone, 50) ) - self.assertEquals( + self.assertEqual( (-1.0, u"\u2011100.0\xa0%"), self._compare_and_render(None, 50) ) - self.assertEquals( + self.assertEqual( (AccountingNone, u""), self._compare_and_render(DataError("#ERR", "."), 1) ) - self.assertEquals( + self.assertEqual( (AccountingNone, u""), self._compare_and_render(1, DataError("#ERR", ".")) ) def test_compare_num_diff(self): - self.assertEquals( + self.assertEqual( (25, u"+25"), self._compare_and_render(75, 50, TYPE_NUM, CMP_DIFF) ) - self.assertEquals( + self.assertEqual( (-25, u"\u201125"), self._compare_and_render(25, 50, TYPE_NUM, CMP_DIFF) ) self.style.suffix_inherit = False self.style.suffix = u"€" - self.assertEquals( + self.assertEqual( (-25, u"\u201125\xa0€"), self._compare_and_render(25, 50, TYPE_NUM, CMP_DIFF), ) self.style.suffix = u"" - self.assertEquals( + self.assertEqual( (50.0, u"+50"), self._compare_and_render(50, AccountingNone, TYPE_NUM, CMP_DIFF), ) - self.assertEquals( + self.assertEqual( (50.0, u"+50"), self._compare_and_render(50, None, TYPE_NUM, CMP_DIFF) ) - self.assertEquals( + self.assertEqual( (-50.0, u"\u201150"), self._compare_and_render(AccountingNone, 50, TYPE_NUM, CMP_DIFF), ) - self.assertEquals( + self.assertEqual( (-50.0, u"\u201150"), self._compare_and_render(None, 50, TYPE_NUM, CMP_DIFF) ) self.style.dp_inherit = False self.style.dp = 2 - self.assertEquals( + self.assertEqual( (0.1, u"+0.10"), self._compare_and_render(1.1, 1.0, TYPE_NUM, CMP_DIFF) ) - self.assertEquals( + self.assertEqual( (AccountingNone, u""), self._compare_and_render(1.001, 1.0, TYPE_NUM, CMP_DIFF), ) def test_compare_pct(self): - self.assertEquals( + self.assertEqual( (0.25, u"+25\xa0pp"), self._compare_and_render(0.75, 0.50, TYPE_PCT) ) - self.assertEquals( + self.assertEqual( (AccountingNone, u""), self._compare_and_render(0.751, 0.750, TYPE_PCT) ) @@ -188,16 +184,16 @@ class TestRendering(common.TransactionCase): result = self.style_obj.compare_and_render( self.lang, style_props, TYPE_PCT, CMP_DIFF, 0.75, 0.50 ) - self.assertEquals(result[3], TYPE_NUM) + self.assertEqual(result[3], TYPE_NUM) def test_merge(self): self.style.color = "#FF0000" self.style.color_inherit = False style_props = self.style_obj.merge([self.style]) - self.assertEquals(style_props, {"color": "#FF0000"}) + self.assertEqual(style_props, {"color": "#FF0000"}) style_dict = {"color": "#00FF00", "dp": 0} style_props = self.style_obj.merge([self.style, style_dict]) - self.assertEquals(style_props, {"color": "#00FF00", "dp": 0}) + self.assertEqual(style_props, {"color": "#00FF00", "dp": 0}) style2 = self.style_obj.create( dict( name="teststyle2", @@ -208,7 +204,7 @@ class TestRendering(common.TransactionCase): ) ) style_props = self.style_obj.merge([self.style, style_dict, style2]) - self.assertEquals(style_props, {"color": "#00FF00", "dp": 1}) + self.assertEqual(style_props, {"color": "#00FF00", "dp": 1}) def test_css(self): self.style.color_inherit = False @@ -229,7 +225,7 @@ class TestRendering(common.TransactionCase): self.style.indent_level = 2 style_props = self.style_obj.merge([self.style]) css = self.style_obj.to_css_style(style_props) - self.assertEquals( + self.assertEqual( css, "font-style: italic; " "font-weight: bold; " @@ -239,7 +235,7 @@ class TestRendering(common.TransactionCase): "text-indent: 2em", ) css = self.style_obj.to_css_style(style_props, no_indent=True) - self.assertEquals( + self.assertEqual( css, "font-style: italic; " "font-weight: bold; " @@ -269,7 +265,7 @@ class TestRendering(common.TransactionCase): self.style.indent_level = 2 style_props = self.style_obj.merge([self.style]) xlsx = self.style_obj.to_xlsx_style(TYPE_NUM, style_props) - self.assertEquals( + self.assertEqual( xlsx, { "italic": True, @@ -282,7 +278,7 @@ class TestRendering(common.TransactionCase): }, ) xlsx = self.style_obj.to_xlsx_style(TYPE_NUM, style_props, no_indent=True) - self.assertEquals( + self.assertEqual( xlsx, { "italic": True, @@ -295,7 +291,7 @@ class TestRendering(common.TransactionCase): ) # percent type ignore prefix and suffix xlsx = self.style_obj.to_xlsx_style(TYPE_PCT, style_props, no_indent=True) - self.assertEquals( + self.assertEqual( xlsx, { "italic": True, @@ -309,7 +305,7 @@ class TestRendering(common.TransactionCase): # str type have no num_format style xlsx = self.style_obj.to_xlsx_style(TYPE_STR, style_props, no_indent=True) - self.assertEquals( + self.assertEqual( xlsx, { "italic": True, diff --git a/mis_builder/views/mis_report_instance.xml b/mis_builder/views/mis_report_instance.xml index 2655e89..cb048a6 100644 --- a/mis_builder/views/mis_report_instance.xml +++ b/mis_builder/views/mis_report_instance.xml @@ -179,6 +179,10 @@ name="analytic_account_id" groups="analytic.group_analytic_accounting" /> + + diff --git a/mis_builder_budget/README.rst b/mis_builder_budget/README.rst index 14d809c..fff0712 100644 --- a/mis_builder_budget/README.rst +++ b/mis_builder_budget/README.rst @@ -14,13 +14,13 @@ MIS Builder Budget :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fmis--builder-lightgray.png?logo=github - :target: https://github.com/OCA/mis-builder/tree/13.0/mis_builder_budget + :target: https://github.com/OCA/mis-builder/tree/14.0/mis_builder_budget :alt: OCA/mis-builder .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/mis-builder-13-0/mis-builder-13-0-mis_builder_budget + :target: https://translation.odoo-community.org/projects/mis-builder-14-0/mis-builder-14-0-mis_builder_budget :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png - :target: https://runbot.odoo-community.org/runbot/248/13.0 + :target: https://runbot.odoo-community.org/runbot/248/14.0 :alt: Try me on Runbot |badge1| |badge2| |badge3| |badge4| |badge5| @@ -85,6 +85,14 @@ be found on GitHub. Changelog ========= +14.0.3.5.1 (2021-04-06) +~~~~~~~~~~~~~~~~~~~~~~~ + +**Bugfixes** + +- Fix incorrect budget by account multi company security rules. (`#347 `_) + + 13.0.3.5.0 (2020-03-28) ~~~~~~~~~~~~~~~~~~~~~~~ @@ -157,7 +165,7 @@ Bug Tracker 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 smashing it by providing a detailed and welcomed -`feedback `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -198,6 +206,6 @@ Current `maintainer `__: |maintainer-sbidoul| -This module is part of the `OCA/mis-builder `_ project on GitHub. +This module is part of the `OCA/mis-builder `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. \ No newline at end of file diff --git a/mis_builder_budget/__manifest__.py b/mis_builder_budget/__manifest__.py index 844efb4..edc7f6e 100644 --- a/mis_builder_budget/__manifest__.py +++ b/mis_builder_budget/__manifest__.py @@ -5,7 +5,7 @@ "name": "MIS Builder Budget", "summary": """ Create budgets for MIS reports""", - "version": "2.0.3.5.0", + "version": "2.0.3.5.1", "license": "AGPL-3", "author": "ACSONE SA/NV, " "Odoo Community Association (OCA)", "website": "https://gitlab.com/flectra-community/mis-builder", @@ -22,7 +22,7 @@ "security/mis_budget_by_account.xml", "views/mis_budget_by_account.xml", ], - "installable": False, + "installable": True, "development_status": "Production/Stable", "maintainers": ["sbidoul"], } diff --git a/mis_builder_budget/i18n/mis_builder_budget.pot b/mis_builder_budget/i18n/mis_builder_budget.pot index 69b9177..d024be3 100644 --- a/mis_builder_budget/i18n/mis_builder_budget.pot +++ b/mis_builder_budget/i18n/mis_builder_budget.pot @@ -4,7 +4,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 13.0\n" +"Project-Id-Version: Odoo Server 14.0\n" "Report-Msgid-Bugs-To: \n" "Last-Translator: \n" "Language-Team: \n" @@ -225,6 +225,10 @@ msgstr "" #: model:ir.model.fields,field_description:mis_builder_budget.field_mis_budget_by_account_item__display_name #: model:ir.model.fields,field_description:mis_builder_budget.field_mis_budget_item__display_name #: model:ir.model.fields,field_description:mis_builder_budget.field_mis_budget_item_abstract__display_name +#: model:ir.model.fields,field_description:mis_builder_budget.field_mis_report_instance__display_name +#: model:ir.model.fields,field_description:mis_builder_budget.field_mis_report_instance_period__display_name +#: model:ir.model.fields,field_description:mis_builder_budget.field_mis_report_kpi__display_name +#: model:ir.model.fields,field_description:mis_builder_budget.field_mis_report_kpi_expression__display_name msgid "Display Name" msgstr "" @@ -279,6 +283,10 @@ msgstr "" #: model:ir.model.fields,field_description:mis_builder_budget.field_mis_budget_by_account_item__id #: model:ir.model.fields,field_description:mis_builder_budget.field_mis_budget_item__id #: model:ir.model.fields,field_description:mis_builder_budget.field_mis_budget_item_abstract__id +#: model:ir.model.fields,field_description:mis_builder_budget.field_mis_report_instance__id +#: model:ir.model.fields,field_description:mis_builder_budget.field_mis_report_instance_period__id +#: model:ir.model.fields,field_description:mis_builder_budget.field_mis_report_kpi__id +#: model:ir.model.fields,field_description:mis_builder_budget.field_mis_report_kpi_expression__id msgid "ID" msgstr "" @@ -332,6 +340,10 @@ msgstr "" #: model:ir.model.fields,field_description:mis_builder_budget.field_mis_budget_by_account_item____last_update #: model:ir.model.fields,field_description:mis_builder_budget.field_mis_budget_item____last_update #: model:ir.model.fields,field_description:mis_builder_budget.field_mis_budget_item_abstract____last_update +#: model:ir.model.fields,field_description:mis_builder_budget.field_mis_report_instance____last_update +#: model:ir.model.fields,field_description:mis_builder_budget.field_mis_report_instance_period____last_update +#: model:ir.model.fields,field_description:mis_builder_budget.field_mis_report_kpi____last_update +#: model:ir.model.fields,field_description:mis_builder_budget.field_mis_report_kpi_expression____last_update msgid "Last Modified on" msgstr "" diff --git a/mis_builder_budget/models/mis_budget_abstract.py b/mis_builder_budget/models/mis_budget_abstract.py index 4d3a84b..8d8b403 100644 --- a/mis_builder_budget/models/mis_budget_abstract.py +++ b/mis_builder_budget/models/mis_budget_abstract.py @@ -10,16 +10,16 @@ class MisBudgetAbstract(models.AbstractModel): _description = "MIS Budget (Abstract Base Class)" _inherit = ["mail.thread"] - name = fields.Char(required=True, track_visibility="onchange") - description = fields.Char(track_visibility="onchange") + name = fields.Char(required=True, tracking=True) + description = fields.Char(tracking=True) date_range_id = fields.Many2one(comodel_name="date.range", string="Date range") - date_from = fields.Date(required=True, string="From", track_visibility="onchange") - date_to = fields.Date(required=True, string="To", track_visibility="onchange") + date_from = fields.Date(required=True, string="From", tracking=True) + date_to = fields.Date(required=True, string="To", tracking=True) state = fields.Selection( [("draft", "Draft"), ("confirmed", "Confirmed"), ("cancelled", "Cancelled")], required=True, default="draft", - track_visibility="onchange", + tracking=True, ) company_id = fields.Many2one( comodel_name="res.company", diff --git a/mis_builder_budget/models/mis_report_instance_period.py b/mis_builder_budget/models/mis_report_instance_period.py index 5e2b6dc..22d1fc1 100644 --- a/mis_builder_budget/models/mis_report_instance_period.py +++ b/mis_builder_budget/models/mis_report_instance_period.py @@ -15,7 +15,11 @@ class MisReportInstancePeriod(models.Model): selection_add=[ (SRC_MIS_BUDGET, "MIS Budget by KPI"), (SRC_MIS_BUDGET_BY_ACCOUNT, "MIS Budget by Account"), - ] + ], + ondelete={ + SRC_MIS_BUDGET: "cascade", + SRC_MIS_BUDGET_BY_ACCOUNT: "cascade", + }, ) source_mis_budget_id = fields.Many2one( comodel_name="mis.budget", string="Budget by KPI" diff --git a/mis_builder_budget/security/mis_budget_by_account.xml b/mis_builder_budget/security/mis_budget_by_account.xml index 19cc9b7..25c3f2b 100644 --- a/mis_builder_budget/security/mis_budget_by_account.xml +++ b/mis_builder_budget/security/mis_budget_by_account.xml @@ -24,7 +24,7 @@ mis.budget.by.account multi company - ['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])] + ['|',('company_id','=',False),('company_id', 'in', company_ids)] diff --git a/mis_builder_budget/security/mis_budget_by_account_item.xml b/mis_builder_budget/security/mis_budget_by_account_item.xml index 4148ecc..308efea 100644 --- a/mis_builder_budget/security/mis_budget_by_account_item.xml +++ b/mis_builder_budget/security/mis_budget_by_account_item.xml @@ -24,7 +24,7 @@ mis.budget.by.account.item multi company - ['|',('budget_id.company_id','=',False),('budget_id.company_id','child_of',[user.company_id.id])] + ['|',('budget_id.company_id','=',False),('budget_id.company_id','in',company_ids)] diff --git a/mis_builder_budget/static/description/index.html b/mis_builder_budget/static/description/index.html index d1347b2..56ec6f4 100644 --- a/mis_builder_budget/static/description/index.html +++ b/mis_builder_budget/static/description/index.html @@ -367,7 +367,7 @@ ul.auto-toc { !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

Production/Stable License: AGPL-3 OCA/mis-builder Translate me on Weblate Try me on Runbot

+

Production/Stable License: AGPL-3 OCA/mis-builder Translate me on Weblate Try me on Runbot

Create budgets for MIS reports.

This module lets you create budgets for any MIS report. Several budgets can be created for a given report template (ie one budget per year). Budget figures @@ -377,31 +377,32 @@ show the budgeted values for each KPI, adjusted for the period of the column.

Table of contents

-

Usage

+

Usage

There are two ways to use this module: create budgets by KPI or budgets by GL accounts. Currently, the two methods cannot be combined in the same budget.

Budget by KPIs

@@ -430,15 +431,22 @@ to the reporting period when displayed. Columns can be compared by adding a column of type “comparison” or “sum”.

-

Known issues / Roadmap

+

Known issues / Roadmap

The mis_builder roadmap and known issues can be found on GitHub.

-

Changelog

+

Changelog

-

13.0.3.5.0 (2020-03-28)

+

14.0.3.5.1 (2021-04-06)

+

Bugfixes

+
    +
  • Fix incorrect budget by account multi company security rules. (#347)
  • +
+
+
+

13.0.3.5.0 (2020-03-28)

Features

  • Budget by GL account: allow budgeting by GL account in addition to the @@ -447,12 +455,12 @@ date, and when reporting a pro-rata temporis adjustment is made to match the reporting period. (#259)
-
-

13.0.3.4.0 (2020-01-??)

+
+

13.0.3.4.0 (2020-01-??)

Migration to odoo 13.0.

-
-

12.0.3.4.0 (2019-10-26)

+
+

12.0.3.4.0 (2019-10-26)

Bugfixes

  • Consider analytic tags too when detecting overlapping budget items. @@ -460,64 +468,64 @@ Previously only analytic account was considered, and this overlap detection mechanism was overlooked when analytic tags were added to budget items. (#241)
-
-

11.0.3.3.0 (2019-01-13)

+
+

11.0.3.3.0 (2019-01-13)

Features

  • Support analytic filters. (#15)
-
-

11.0.3.2.1 (2018-06-30)

+
+

11.0.3.2.1 (2018-06-30)

  • [IMP] Support analytic tags in budget items (#100)
-
-

11.0.3.2.0 (2018-05-02)

+
+

11.0.3.2.0 (2018-05-02)

  • [FIX] #NAME error in out-of-order computation of non budgetable items in budget columns (#68)
-
-

11.0.3.1.1 (2018-02-04)

+
+

11.0.3.1.1 (2018-02-04)

Migration to Odoo 11. No new feature. (#67)

-
-

10.0.3.1.0 (2017-11-14)

+
+

10.0.3.1.0 (2017-11-14)

New features:

  • [ADD] multi-company record rule for MIS Budgets (#27)
-
-

Bug Tracker

+

Bug Tracker

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 smashing it by providing a detailed and welcomed -feedback.

+feedback.

Do not contact contributors directly about support or help with technical issues.

-

Credits

+

Credits

-

Authors

+

Authors

  • ACSONE SA/NV
-

Contributors

+

Contributors

-

Maintainers

+

Maintainers

This module is maintained by the OCA.

Odoo Community Association

OCA, or the Odoo Community Association, is a nonprofit organization whose @@ -534,7 +542,7 @@ mission is to support the collaborative development of Odoo features and promote its widespread use.

Current maintainer:

sbidoul

-

This module is part of the OCA/mis-builder project on GitHub.

+

This module is part of the OCA/mis-builder project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

diff --git a/mis_builder_demo/README.rst b/mis_builder_demo/README.rst index 66a0b23..e5f4b25 100644 --- a/mis_builder_demo/README.rst +++ b/mis_builder_demo/README.rst @@ -14,13 +14,13 @@ MIS Builder Demo :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fmis--builder-lightgray.png?logo=github - :target: https://github.com/OCA/mis-builder/tree/13.0/mis_builder_demo + :target: https://github.com/OCA/mis-builder/tree/14.0/mis_builder_demo :alt: OCA/mis-builder .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/mis-builder-13-0/mis-builder-13-0-mis_builder_demo + :target: https://translation.odoo-community.org/projects/mis-builder-14-0/mis-builder-14-0-mis_builder_demo :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png - :target: https://runbot.odoo-community.org/runbot/248/13.0 + :target: https://runbot.odoo-community.org/runbot/248/14.0 :alt: Try me on Runbot |badge1| |badge2| |badge3| |badge4| |badge5| @@ -109,7 +109,7 @@ Bug Tracker 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 smashing it by providing a detailed and welcomed -`feedback `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -148,6 +148,6 @@ Current `maintainer `__: |maintainer-sbidoul| -This module is part of the `OCA/mis-builder `_ project on GitHub. +This module is part of the `OCA/mis-builder `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. \ No newline at end of file diff --git a/mis_builder_demo/__manifest__.py b/mis_builder_demo/__manifest__.py index 449f349..36f4969 100644 --- a/mis_builder_demo/__manifest__.py +++ b/mis_builder_demo/__manifest__.py @@ -5,7 +5,7 @@ "name": "MIS Builder Demo", "summary": """ Demo addon for MIS Builder""", - "version": "2.0.3.1.2", + "version": "2.0.3.1.3", "license": "AGPL-3", "author": "ACSONE SA/NV, " "Odoo Community Association (OCA)", "website": "https://gitlab.com/flectra-community/mis-builder", @@ -18,7 +18,7 @@ "data/mis_budget.xml", "data/mis_report_instance.xml", ], - "installable": False, + "installable": True, "maintainers": ["sbidoul"], "development_status": "Alpha", } diff --git a/mis_builder_demo/i18n/mis_builder_demo.pot b/mis_builder_demo/i18n/mis_builder_demo.pot index 08a70c8..7dfd0fa 100644 --- a/mis_builder_demo/i18n/mis_builder_demo.pot +++ b/mis_builder_demo/i18n/mis_builder_demo.pot @@ -4,7 +4,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 13.0\n" +"Project-Id-Version: Odoo Server 14.0\n" "Report-Msgid-Bugs-To: \n" "Last-Translator: \n" "Language-Team: \n" diff --git a/mis_builder_demo/models/mis_committed_purchase.sql b/mis_builder_demo/models/mis_committed_purchase.sql index 21b07e1..0d83674 100644 --- a/mis_builder_demo/models/mis_committed_purchase.sql +++ b/mis_builder_demo/models/mis_committed_purchase.sql @@ -81,7 +81,7 @@ CREATE OR REPLACE VIEW mis_committed_purchase AS ( cur.date_start <= coalesce(ai.invoice_date, now()) and (cur.date_end is null or cur.date_end > coalesce(ai.invoice_date, now()))) WHERE ai.state = 'draft' - AND ai.type IN ('in_invoice', 'out_refund') + AND ai.move_type IN ('in_invoice', 'out_refund') AND NOT ail.exclude_from_invoice_tab UNION ALL @@ -111,7 +111,7 @@ CREATE OR REPLACE VIEW mis_committed_purchase AS ( cur.date_start <= coalesce(ai.invoice_date, now()) and (cur.date_end is null or cur.date_end > coalesce(ai.invoice_date, now()))) WHERE ai.state = 'draft' - AND ai.type IN ('out_invoice', 'in_refund') + AND ai.move_type IN ('out_invoice', 'in_refund') AND NOT ail.exclude_from_invoice_tab ) AS mis_committed_purchase diff --git a/mis_builder_demo/static/description/index.html b/mis_builder_demo/static/description/index.html index 366a32d..76f5228 100644 --- a/mis_builder_demo/static/description/index.html +++ b/mis_builder_demo/static/description/index.html @@ -367,7 +367,7 @@ ul.auto-toc { !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

Alpha License: AGPL-3 OCA/mis-builder Translate me on Weblate Try me on Runbot

+

Alpha License: AGPL-3 OCA/mis-builder Translate me on Weblate Try me on Runbot

Demo addon for MIS Builder.

Important

@@ -459,7 +459,7 @@ any compatibility guarantees. (GitHub Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us smashing it by providing a detailed and welcomed -feedback.

+feedback.

Do not contact contributors directly about support or help with technical issues.

@@ -486,7 +486,7 @@ mission is to support the collaborative development of Odoo features and promote its widespread use.

Current maintainer:

sbidoul

-

This module is part of the OCA/mis-builder project on GitHub.

+

This module is part of the OCA/mis-builder project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.