Skip to content

Commit

Permalink
Merge PR #36 into 16.0
Browse files Browse the repository at this point in the history
Signed-off-by simahawk
  • Loading branch information
OCA-git-bot committed Aug 1, 2023
2 parents aaa3ee8 + 81ed622 commit 15e97d6
Show file tree
Hide file tree
Showing 17 changed files with 710 additions and 0 deletions.
105 changes: 105 additions & 0 deletions mis_builder_budget_product/README.rst
@@ -0,0 +1,105 @@
================================
MIS Builder Budget Contributions
================================

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |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/16.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-16-0/mis-builder-contrib-16-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/webui/builds.html?repo=OCA/mis-builder-contrib&target_branch=16.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 smashing it by providing a detailed and welcomed
`feedback <https://github.com/OCA/mis-builder-contrib/issues/new?body=module:%20mis_builder_budget_product%0Aversion:%2016.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 <camille.morand@camptocamp.com>
* `Trobz <https://trobz.com>`_:
* Dzung Tran <dungtd@trobz.com>

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/16.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
@@ -0,0 +1 @@
from . import models
17 changes: 17 additions & 0 deletions 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": "16.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,
}
24 changes: 24 additions & 0 deletions 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 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_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
@@ -0,0 +1 @@
from . import mis_budget_by_account_item
46 changes: 46 additions & 0 deletions mis_builder_budget_product/models/mis_budget_by_account_item.py
@@ -0,0 +1,46 @@
# 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
3 changes: 3 additions & 0 deletions mis_builder_budget_product/readme/CONTRIBUTORS.rst
@@ -0,0 +1,3 @@
* Camille Morand <camille.morand@camptocamp.com>
* `Trobz <https://trobz.com>`_:
* Dzung Tran <dungtd@trobz.com>
1 change: 1 addition & 0 deletions mis_builder_budget_product/readme/CREDITS.rst
@@ -0,0 +1 @@
The migration of this module from 15.0 to 16.0 was financially supported by Camptocamp
3 changes: 3 additions & 0 deletions mis_builder_budget_product/readme/DESCRIPTION.rst
@@ -0,0 +1,3 @@
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.rst
@@ -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.
3 changes: 3 additions & 0 deletions mis_builder_budget_product/readme/ROADMAP.rst
@@ -0,0 +1,3 @@
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.rst
@@ -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.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 15e97d6

Please sign in to comment.