diff --git a/mis_builder_budget_product/README.rst b/mis_builder_budget_product/README.rst new file mode 100644 index 0000000..af5f7d5 --- /dev/null +++ b/mis_builder_budget_product/README.rst @@ -0,0 +1,116 @@ +================================ +MIS Builder Budget Contributions +================================ + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:aa82b2d92d83e47acf7b45024789c0de275f31cdb257b3918857a12e087eae23 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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%2Fmis--builder--contrib-lightgray.png?logo=github + :target: https://github.com/OCA/mis-builder-contrib/tree/17.0/mis_builder_budget_product + :alt: OCA/mis-builder-contrib +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/mis-builder-contrib-17-0/mis-builder-contrib-17-0-mis_builder_budget_product + :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/mis-builder-contrib&target_branch=17.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This modules offers some additions to the original MIS Builder Budget +module : + +- It allows to display the product in the budget lines by account (and + to filter by product in the MIS reports) + +**Table of contents** + +.. contents:: + :local: + +Usage +===== + +**Budget by GL accounts** + +When a budget by GL accounts is created, it is optionally populated with +one line per product besides the default behaviour. + +Known issues / Roadmap +====================== + +The mis_builder +`roadmap `__ +and `known +issues `__ +can be found on github. + +Changelog +========= + +15.0.1.0.0 +---------- + +- Create a new module to add features to MIS Builder Budget. For now, it + adds the product_id to the Budget items by account. + +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 +------- + +* Camptocamp + +Contributors +------------ + +- Camille Morand + +- `Trobz `__: + + - Dzung Tran + +Other credits +------------- + +The migration of this module from 15.0 to 16.0 was financially supported +by Camptocamp + +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/mis-builder-contrib `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/mis_builder_budget_product/__init__.py b/mis_builder_budget_product/__init__.py new file mode 100644 index 0000000..0650744 --- /dev/null +++ b/mis_builder_budget_product/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/mis_builder_budget_product/__manifest__.py b/mis_builder_budget_product/__manifest__.py new file mode 100644 index 0000000..d1358b1 --- /dev/null +++ b/mis_builder_budget_product/__manifest__.py @@ -0,0 +1,17 @@ +# Copyright 2022 Camptocamp SA (https://www.camptocamp.com) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +{ + "name": "MIS Builder Budget Contributions", + "summary": """ + Offer more options for budgets for MIS reports""", + "version": "17.0.1.0.0", + "license": "AGPL-3", + "author": "Camptocamp, Odoo Community Association (OCA)", + "website": "https://github.com/OCA/mis-builder-contrib", + "depends": ["mis_builder_budget"], + "data": [ + "views/mis_budget_by_account_item.xml", + ], + "installable": True, +} diff --git a/mis_builder_budget_product/i18n/it.po b/mis_builder_budget_product/i18n/it.po new file mode 100644 index 0000000..03a5b2a --- /dev/null +++ b/mis_builder_budget_product/i18n/it.po @@ -0,0 +1,27 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mis_builder_budget_product +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2024-09-11 09:06+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 5.6.2\n" + +#. module: mis_builder_budget_product +#: model:ir.model,name:mis_builder_budget_product.model_mis_budget_by_account_item +msgid "MIS Budget Item (by Account)" +msgstr "Voce budget MIS (per conto)" + +#. module: mis_builder_budget_product +#: model:ir.model.fields,field_description:mis_builder_budget_product.field_mis_budget_by_account_item__product_id +msgid "Product" +msgstr "Prodotto" diff --git a/mis_builder_budget_product/i18n/mis_builder_budget_product.pot b/mis_builder_budget_product/i18n/mis_builder_budget_product.pot new file mode 100644 index 0000000..06885ac --- /dev/null +++ b/mis_builder_budget_product/i18n/mis_builder_budget_product.pot @@ -0,0 +1,24 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mis_builder_budget_product +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.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_budget_product +#: model:ir.model,name:mis_builder_budget_product.model_mis_budget_by_account_item +msgid "MIS Budget Item (by Account)" +msgstr "" + +#. module: mis_builder_budget_product +#: model:ir.model.fields,field_description:mis_builder_budget_product.field_mis_budget_by_account_item__product_id +msgid "Product" +msgstr "" diff --git a/mis_builder_budget_product/models/__init__.py b/mis_builder_budget_product/models/__init__.py new file mode 100644 index 0000000..e1afecd --- /dev/null +++ b/mis_builder_budget_product/models/__init__.py @@ -0,0 +1 @@ +from . import mis_budget_by_account_item diff --git a/mis_builder_budget_product/models/mis_budget_by_account_item.py b/mis_builder_budget_product/models/mis_budget_by_account_item.py new file mode 100644 index 0000000..e2244c1 --- /dev/null +++ b/mis_builder_budget_product/models/mis_budget_by_account_item.py @@ -0,0 +1,45 @@ +# Copyright 2022 Camptocamp SA (https://www.camptocamp.com) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +from odoo import api, fields, models +from odoo.osv import expression + + +class MisBudgetByAccountItem(models.Model): + _inherit = "mis.budget.by.account.item" + _order = "budget_id, date_from, account_id, product_id" + + product_id = fields.Many2one( + comodel_name="product.product", + domain="['|', ('company_id', '=', False), ('company_id', '=', company_id)]", + ) + + def _prepare_overlap_domain(self): + # Two budget items are not overlapping if they have different products. However, + # if they are similar for every other point, and they have the same product, or + # at least one of the lines has no defined product (which means that it includes + # the product of the other line), they are overlapping. + domain = super()._prepare_overlap_domain() + if self.product_id: + # If the current line has a product, we have overlapping for another line + # with the same product or an empty one + domain = expression.AND( + [ + domain, + [ + "|", + ("product_id", "=", False), + ("product_id", "=", self.product_id.id), + ], + ] + ) + # If the current line has no product, it includes all of them, so a similar line + # implies overlapping, no matter the value of product_id + return domain + + @api.constrains( + "product_id", + ) + def _check_product(self): + """Check dates if product changes.""" + self._check_dates() + return diff --git a/mis_builder_budget_product/pyproject.toml b/mis_builder_budget_product/pyproject.toml new file mode 100644 index 0000000..4231d0c --- /dev/null +++ b/mis_builder_budget_product/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/mis_builder_budget_product/readme/CONTRIBUTORS.md b/mis_builder_budget_product/readme/CONTRIBUTORS.md new file mode 100644 index 0000000..e903605 --- /dev/null +++ b/mis_builder_budget_product/readme/CONTRIBUTORS.md @@ -0,0 +1,4 @@ +- Camille Morand \<\> + +- [Trobz](https://trobz.com): + - Dzung Tran \<\> diff --git a/mis_builder_budget_product/readme/CREDITS.md b/mis_builder_budget_product/readme/CREDITS.md new file mode 100644 index 0000000..291e14c --- /dev/null +++ b/mis_builder_budget_product/readme/CREDITS.md @@ -0,0 +1,2 @@ +The migration of this module from 15.0 to 16.0 was financially supported +by Camptocamp diff --git a/mis_builder_budget_product/readme/DESCRIPTION.md b/mis_builder_budget_product/readme/DESCRIPTION.md new file mode 100644 index 0000000..b61c687 --- /dev/null +++ b/mis_builder_budget_product/readme/DESCRIPTION.md @@ -0,0 +1,5 @@ +This modules offers some additions to the original MIS Builder Budget +module : + +- It allows to display the product in the budget lines by account (and + to filter by product in the MIS reports) diff --git a/mis_builder_budget_product/readme/HISTORY.md b/mis_builder_budget_product/readme/HISTORY.md new file mode 100644 index 0000000..3dadd7c --- /dev/null +++ b/mis_builder_budget_product/readme/HISTORY.md @@ -0,0 +1,4 @@ +## 15.0.1.0.0 + +- Create a new module to add features to MIS Builder Budget. For now, it + adds the product_id to the Budget items by account. diff --git a/mis_builder_budget_product/readme/ROADMAP.md b/mis_builder_budget_product/readme/ROADMAP.md new file mode 100644 index 0000000..a7937fe --- /dev/null +++ b/mis_builder_budget_product/readme/ROADMAP.md @@ -0,0 +1,5 @@ +The mis_builder +[roadmap](https://github.com/OCA/mis-builder-contrib/issues?q=is%3Aopen+is%3Aissue+label%3Aenhancement) +and [known +issues](https://github.com/OCA/mis-builder-contrib/issues?q=is%3Aopen+is%3Aissue+label%3Abug) +can be found on github. diff --git a/mis_builder_budget_product/readme/USAGE.md b/mis_builder_budget_product/readme/USAGE.md new file mode 100644 index 0000000..840083c --- /dev/null +++ b/mis_builder_budget_product/readme/USAGE.md @@ -0,0 +1,4 @@ +**Budget by GL accounts** + +When a budget by GL accounts is created, it is optionally populated with +one line per product besides the default behaviour. diff --git a/mis_builder_budget_product/static/description/icon.png b/mis_builder_budget_product/static/description/icon.png new file mode 100644 index 0000000..1afa781 Binary files /dev/null and b/mis_builder_budget_product/static/description/icon.png differ diff --git a/mis_builder_budget_product/static/description/index.html b/mis_builder_budget_product/static/description/index.html new file mode 100644 index 0000000..8a68880 --- /dev/null +++ b/mis_builder_budget_product/static/description/index.html @@ -0,0 +1,468 @@ + + + + + +MIS Builder Budget Contributions + + + +
+

MIS Builder Budget Contributions

+ + +

Beta License: AGPL-3 OCA/mis-builder-contrib Translate me on Weblate Try me on Runboat

+

This modules offers some additions to the original MIS Builder Budget +module :

+
    +
  • It allows to display the product in the budget lines by account (and +to filter by product in the MIS reports)
  • +
+

Table of contents

+ +
+

Usage

+

Budget by GL accounts

+

When a budget by GL accounts is created, it is optionally populated with +one line per product besides the default behaviour.

+
+
+

Known issues / Roadmap

+

The mis_builder +roadmap +and known +issues +can be found on github.

+
+
+

Changelog

+
+

15.0.1.0.0

+
    +
  • Create a new module to add features to MIS Builder Budget. For now, it +adds the product_id to the Budget items by account.
  • +
+
+
+
+

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

+
    +
  • Camptocamp
  • +
+
+
+

Contributors

+ +
+
+

Other credits

+

The migration of this module from 15.0 to 16.0 was financially supported +by Camptocamp

+
+
+

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/mis-builder-contrib project on GitHub.

+

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

+
+
+
+ + diff --git a/mis_builder_budget_product/views/mis_budget_by_account_item.xml b/mis_builder_budget_product/views/mis_budget_by_account_item.xml new file mode 100644 index 0000000..8942b01 --- /dev/null +++ b/mis_builder_budget_product/views/mis_budget_by_account_item.xml @@ -0,0 +1,31 @@ + + + + + mis.budget.by.account.item + + + + + + + + + + mis.budget.by.account.item + + + + + + + + +