diff --git a/mis_builder_operating_unit/README.rst b/mis_builder_operating_unit/README.rst new file mode 100644 index 0000000000..47325f43e1 --- /dev/null +++ b/mis_builder_operating_unit/README.rst @@ -0,0 +1,85 @@ +=============================== +MIS Builder with Operating Unit +=============================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:c8ada1ac3e9fb55193d31022fda527d98e679fe9f3fce114e4092722bb6a91e4 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Foperating--unit-lightgray.png?logo=github + :target: https://github.com/OCA/operating-unit/tree/18.0/mis_builder_operating_unit + :alt: OCA/operating-unit +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/operating-unit-18-0/operating-unit-18-0-mis_builder_operating_unit + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png + :target: https://runboat.odoo-community.org/builds?repo=OCA/operating-unit&target_branch=18.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +Introduces the operating unit to MIS Builder report instances. + +**Table of contents** + +.. contents:: + :local: + +Usage +===== + +Set the operating unit in a MIS Builder instance. + +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 to smash it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +------- + +* ForgeFlow +* Serpent Consulting Services Pvt. Ltd. +* ACSONE SA/NV +* CIT Services + +Contributors +------------ + +- Stéphane Bidoul +- Kitti U. (migration to v14) + +Maintainers +----------- + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +This module is part of the `OCA/operating-unit `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/mis_builder_operating_unit/__init__.py b/mis_builder_operating_unit/__init__.py new file mode 100644 index 0000000000..3bbf81aeec --- /dev/null +++ b/mis_builder_operating_unit/__init__.py @@ -0,0 +1,3 @@ +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). + +from . import model diff --git a/mis_builder_operating_unit/__manifest__.py b/mis_builder_operating_unit/__manifest__.py new file mode 100644 index 0000000000..24c6b5fdf0 --- /dev/null +++ b/mis_builder_operating_unit/__manifest__.py @@ -0,0 +1,21 @@ +# Copyright 2015-19 ForgeFlow S.L. - +# Jordi Ballester Alomar +# © 2015-19 Serpent Consulting Services Pvt. Ltd. - Sudhir Arya +# © 2026 CIT Services +# License AGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). + +{ + "name": "MIS Builder with Operating Unit", + "version": "18.0.0.1.0", + "category": "Reporting", + "author": "ForgeFlow, " + "Serpent Consulting Services Pvt. Ltd.," + "ACSONE SA/NV," + "CIT Services," + "Odoo Community Association (OCA)", + "license": "AGPL-3", + "website": "https://github.com/OCA/operating-unit", + "depends": ["mis_builder", "account_operating_unit"], + "data": ["security/mis_builder_security.xml", "view/mis_builder.xml"], + "installable": True, +} diff --git a/mis_builder_operating_unit/i18n/da.po b/mis_builder_operating_unit/i18n/da.po new file mode 100644 index 0000000000..59d9e719ee --- /dev/null +++ b/mis_builder_operating_unit/i18n/da.po @@ -0,0 +1,39 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mis_builder_operating_unit +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2020-04-16 13:23+0000\n" +"Last-Translator: Hans Henrik Gabelgaard \n" +"Language-Team: none\n" +"Language: da\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 3.10\n" + +#. module: mis_builder_operating_unit +#: model:ir.model.fields,field_description:mis_builder_operating_unit.field_mis_report_instance__has_no_operating_unit +#: model:ir.model.fields,field_description:mis_builder_operating_unit.field_mis_report_instance_period__has_no_operating_unit +msgid "Has No Operating Unit" +msgstr "" + +#. module: mis_builder_operating_unit +#: model:ir.model,name:mis_builder_operating_unit.model_mis_report_instance +msgid "MIS Report Instance" +msgstr "MIS Rapport Instans" + +#. module: mis_builder_operating_unit +#: model:ir.model,name:mis_builder_operating_unit.model_mis_report_instance_period +msgid "MIS Report Instance Period" +msgstr "MIS Rapport instans periode" + +#. module: mis_builder_operating_unit +#: model:ir.model.fields,field_description:mis_builder_operating_unit.field_mis_report_instance__operating_unit_ids +#: model:ir.model.fields,field_description:mis_builder_operating_unit.field_mis_report_instance_period__operating_unit_ids +msgid "Operating Unit" +msgstr "Driftsenhed" diff --git a/mis_builder_operating_unit/i18n/it.po b/mis_builder_operating_unit/i18n/it.po new file mode 100644 index 0000000000..61f9fc4242 --- /dev/null +++ b/mis_builder_operating_unit/i18n/it.po @@ -0,0 +1,48 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mis_builder_operating_unit +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2024-03-22 10:34+0000\n" +"Last-Translator: mymage \n" +"Language-Team: none\n" +"Language: it\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.17\n" + +#. module: mis_builder_operating_unit +#: model:ir.model.fields,field_description:mis_builder_operating_unit.field_mis_report_instance__has_no_operating_unit +#: model:ir.model.fields,field_description:mis_builder_operating_unit.field_mis_report_instance_period__has_no_operating_unit +msgid "Has No Operating Unit" +msgstr "" + +#. module: mis_builder_operating_unit +#: model:ir.model,name:mis_builder_operating_unit.model_mis_report_instance +msgid "MIS Report Instance" +msgstr "Istanza MIS Report" + +#. module: mis_builder_operating_unit +#: model:ir.model,name:mis_builder_operating_unit.model_mis_report_instance_period +msgid "MIS Report Instance Period" +msgstr "Periodo istanza MIS Report" + +#. module: mis_builder_operating_unit +#: model:ir.model.fields,field_description:mis_builder_operating_unit.field_mis_report_instance__operating_unit_ids +#: model:ir.model.fields,field_description:mis_builder_operating_unit.field_mis_report_instance_period__operating_unit_ids +msgid "Operating Unit" +msgstr "Unità operativa" + +#~ msgid "Display Name" +#~ msgstr "Nome visualizzato" + +#~ msgid "ID" +#~ msgstr "ID" + +#~ msgid "Last Modified on" +#~ msgstr "Ultima modifica il" diff --git a/mis_builder_operating_unit/i18n/mis_builder_operating_unit.pot b/mis_builder_operating_unit/i18n/mis_builder_operating_unit.pot new file mode 100644 index 0000000000..bcce575fd3 --- /dev/null +++ b/mis_builder_operating_unit/i18n/mis_builder_operating_unit.pot @@ -0,0 +1,36 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mis_builder_operating_unit +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 15.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: mis_builder_operating_unit +#: model:ir.model.fields,field_description:mis_builder_operating_unit.field_mis_report_instance__has_no_operating_unit +#: model:ir.model.fields,field_description:mis_builder_operating_unit.field_mis_report_instance_period__has_no_operating_unit +msgid "Has No Operating Unit" +msgstr "" + +#. module: mis_builder_operating_unit +#: model:ir.model,name:mis_builder_operating_unit.model_mis_report_instance +msgid "MIS Report Instance" +msgstr "" + +#. module: mis_builder_operating_unit +#: model:ir.model,name:mis_builder_operating_unit.model_mis_report_instance_period +msgid "MIS Report Instance Period" +msgstr "" + +#. module: mis_builder_operating_unit +#: model:ir.model.fields,field_description:mis_builder_operating_unit.field_mis_report_instance__operating_unit_ids +#: model:ir.model.fields,field_description:mis_builder_operating_unit.field_mis_report_instance_period__operating_unit_ids +msgid "Operating Unit" +msgstr "" diff --git a/mis_builder_operating_unit/model/__init__.py b/mis_builder_operating_unit/model/__init__.py new file mode 100644 index 0000000000..67e8cc9971 --- /dev/null +++ b/mis_builder_operating_unit/model/__init__.py @@ -0,0 +1,3 @@ +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). + +from . import mis_builder diff --git a/mis_builder_operating_unit/model/mis_builder.py b/mis_builder_operating_unit/model/mis_builder.py new file mode 100644 index 0000000000..ef69f6319d --- /dev/null +++ b/mis_builder_operating_unit/model/mis_builder.py @@ -0,0 +1,70 @@ +# Copyright 2015-19 ForgeFlow S.L. - +# Jordi Ballester Alomar +# Copyright 2015-19 Serpent Consulting Services Pvt. Ltd. - Sudhir Arya +# Copyright 2018-19 ACSONE SA/NV +# Copyright 2026-27 CIT Services - Solomon Prabu +# Copyright 2024 Level Prime Srl - Roberto Fichera +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +from odoo import api, fields, models + + +class MisReportInstance(models.Model): + _inherit = "mis.report.instance" + + operating_unit_ids = fields.Many2many( + comodel_name="operating.unit", + ) + + has_no_operating_unit = fields.Boolean() + + @api.onchange("has_no_operating_unit") + def _onchange_has_no_operating_unit(self): + if self.has_no_operating_unit: + self.operating_unit_ids = False + + +class MisReportInstancePeriod(models.Model): + _inherit = "mis.report.instance.period" + + operating_unit_ids = fields.Many2many( + comodel_name="operating.unit", + ) + + has_no_operating_unit = fields.Boolean() + + @api.onchange("has_no_operating_unit") + def _onchange_has_no_operating_unit(self): + if self.has_no_operating_unit: + self.operating_unit_ids = False + + def _get_additional_move_line_filter(self): + self.ensure_one() + aml_domain = super()._get_additional_move_line_filter() + # we need sudo because, imagine a user having access + # to operating unit A, viewing a report with 3 columns + # for OU A, B, C: in columns B and C, self.operating_unit_ids + # would be empty for him, and the query on a.m.l would be only + # restricted by the record rules (ie showing move lines + # for OU A only). So the report would display values + # for OU A in all 3 columns. + sudoself = self.sudo() + + if sudoself.has_no_operating_unit: + aml_domain.append(("operating_unit_id", "=", False)) + elif sudoself.report_instance_id.has_no_operating_unit: + aml_domain.append(("operating_unit_id", "=", False)) + else: + if sudoself.report_instance_id.operating_unit_ids: + aml_domain.append( + ( + "operating_unit_id", + "in", + sudoself.report_instance_id.operating_unit_ids.ids, + ) + ) + if sudoself.operating_unit_ids: + aml_domain.append( + ("operating_unit_id", "in", sudoself.operating_unit_ids.ids) + ) + return aml_domain diff --git a/mis_builder_operating_unit/pyproject.toml b/mis_builder_operating_unit/pyproject.toml new file mode 100644 index 0000000000..4231d0cccb --- /dev/null +++ b/mis_builder_operating_unit/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/mis_builder_operating_unit/readme/CONTRIBUTORS.md b/mis_builder_operating_unit/readme/CONTRIBUTORS.md new file mode 100644 index 0000000000..88bc2eb4c0 --- /dev/null +++ b/mis_builder_operating_unit/readme/CONTRIBUTORS.md @@ -0,0 +1,2 @@ +- Stéphane Bidoul \ +- Kitti U. \ (migration to v14) diff --git a/mis_builder_operating_unit/readme/DESCRIPTION.md b/mis_builder_operating_unit/readme/DESCRIPTION.md new file mode 100644 index 0000000000..f2ac48bde3 --- /dev/null +++ b/mis_builder_operating_unit/readme/DESCRIPTION.md @@ -0,0 +1 @@ +Introduces the operating unit to MIS Builder report instances. diff --git a/mis_builder_operating_unit/readme/USAGE.md b/mis_builder_operating_unit/readme/USAGE.md new file mode 100644 index 0000000000..ac487022f9 --- /dev/null +++ b/mis_builder_operating_unit/readme/USAGE.md @@ -0,0 +1 @@ +Set the operating unit in a MIS Builder instance. diff --git a/mis_builder_operating_unit/security/mis_builder_security.xml b/mis_builder_operating_unit/security/mis_builder_security.xml new file mode 100644 index 0000000000..4239dfba89 --- /dev/null +++ b/mis_builder_operating_unit/security/mis_builder_security.xml @@ -0,0 +1,19 @@ + + + + + + + + + ['|',('operating_unit_ids','=',False),('operating_unit_ids','in',[g.id for g in user.operating_unit_ids])] + MIS Reports from allowed operating units + + + + + + + diff --git a/mis_builder_operating_unit/static/description/icon.png b/mis_builder_operating_unit/static/description/icon.png new file mode 100644 index 0000000000..3a0328b516 Binary files /dev/null and b/mis_builder_operating_unit/static/description/icon.png differ diff --git a/mis_builder_operating_unit/static/description/index.html b/mis_builder_operating_unit/static/description/index.html new file mode 100644 index 0000000000..9ff3bfbabc --- /dev/null +++ b/mis_builder_operating_unit/static/description/index.html @@ -0,0 +1,432 @@ + + + + + +MIS Builder with Operating Unit + + + +
+

MIS Builder with Operating Unit

+ + +

Beta License: AGPL-3 OCA/operating-unit Translate me on Weblate Try me on Runboat

+

Introduces the operating unit to MIS Builder report instances.

+

Table of contents

+ +
+

Usage

+

Set the operating unit in a MIS Builder instance.

+
+
+

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

+

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

+
+
+

Credits

+
+

Authors

+
    +
  • ForgeFlow
  • +
  • Serpent Consulting Services Pvt. Ltd.
  • +
  • ACSONE SA/NV
  • +
  • CIT Services
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+ +Odoo Community Association + +

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

+

This module is part of the OCA/operating-unit project on GitHub.

+

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

+
+
+
+ + diff --git a/mis_builder_operating_unit/view/mis_builder.xml b/mis_builder_operating_unit/view/mis_builder.xml new file mode 100644 index 0000000000..9d3e6c776d --- /dev/null +++ b/mis_builder_operating_unit/view/mis_builder.xml @@ -0,0 +1,62 @@ + + + + mis.report.instance.view.tree + mis.report.instance + + + + + + + + + mis.report.instance.view.form + mis.report.instance + + + + + + + + + + + mis.report.instance.period.view.form + mis.report.instance.period + + + + + + + + + +