Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[17.0][MIG] mis_builder_budget_product: Migration to 17.0 #53

Open
wants to merge 12 commits into
base: 17.0
Choose a base branch
from
116 changes: 116 additions & 0 deletions mis_builder_budget_product/README.rst
Original file line number Diff line number Diff line change
@@ -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 <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.

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 <https://github.com/OCA/mis-builder-contrib/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 <https://github.com/OCA/mis-builder-contrib/issues/new?body=module:%20mis_builder_budget_product%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

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

Credits
=======

Authors
-------

* Camptocamp

Contributors
------------

- Camille Morand <[email protected]>

- `Trobz <https://trobz.com>`__:

- Dzung Tran <[email protected]>

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 <https://github.com/OCA/mis-builder-contrib/tree/17.0/mis_builder_budget_product>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions mis_builder_budget_product/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
17 changes: 17 additions & 0 deletions mis_builder_budget_product/__manifest__.py
Original file line number Diff line number Diff line change
@@ -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,
}
27 changes: 27 additions & 0 deletions mis_builder_budget_product/i18n/it.po
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>\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"
24 changes: 24 additions & 0 deletions mis_builder_budget_product/i18n/mis_builder_budget_product.pot
Original file line number Diff line number Diff line change
@@ -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 ""
1 change: 1 addition & 0 deletions mis_builder_budget_product/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import mis_budget_by_account_item
45 changes: 45 additions & 0 deletions mis_builder_budget_product/models/mis_budget_by_account_item.py
Original file line number Diff line number Diff line change
@@ -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()

Check warning on line 21 in mis_builder_budget_product/models/mis_budget_by_account_item.py

View check run for this annotation

Codecov / codecov/patch

mis_builder_budget_product/models/mis_budget_by_account_item.py#L21

Added line #L21 was not covered by tests
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(

Check warning on line 25 in mis_builder_budget_product/models/mis_budget_by_account_item.py

View check run for this annotation

Codecov / codecov/patch

mis_builder_budget_product/models/mis_budget_by_account_item.py#L25

Added line #L25 was not covered by tests
[
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

Check warning on line 37 in mis_builder_budget_product/models/mis_budget_by_account_item.py

View check run for this annotation

Codecov / codecov/patch

mis_builder_budget_product/models/mis_budget_by_account_item.py#L37

Added line #L37 was not covered by tests

@api.constrains(
"product_id",
)
def _check_product(self):
"""Check dates if product changes."""
self._check_dates()
return

Check warning on line 45 in mis_builder_budget_product/models/mis_budget_by_account_item.py

View check run for this annotation

Codecov / codecov/patch

mis_builder_budget_product/models/mis_budget_by_account_item.py#L44-L45

Added lines #L44 - L45 were not covered by tests
3 changes: 3 additions & 0 deletions mis_builder_budget_product/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
4 changes: 4 additions & 0 deletions mis_builder_budget_product/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
- Camille Morand \<<[email protected]>\>

- [Trobz](https://trobz.com):
- Dzung Tran \<<[email protected]>\>
2 changes: 2 additions & 0 deletions mis_builder_budget_product/readme/CREDITS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
The migration of this module from 15.0 to 16.0 was financially supported
by Camptocamp
5 changes: 5 additions & 0 deletions mis_builder_budget_product/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -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)
4 changes: 4 additions & 0 deletions mis_builder_budget_product/readme/HISTORY.md
Original file line number Diff line number Diff line change
@@ -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.
5 changes: 5 additions & 0 deletions mis_builder_budget_product/readme/ROADMAP.md
Original file line number Diff line number Diff line change
@@ -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.
4 changes: 4 additions & 0 deletions mis_builder_budget_product/readme/USAGE.md
Original file line number Diff line number Diff line change
@@ -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.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading