Skip to content

Commit

Permalink
Merge pull request #439 from ecosoft-odoo/16.0-mig-budget_control
Browse files Browse the repository at this point in the history
[16.0][MIG] budget_control
  • Loading branch information
Saran440 authored Aug 1, 2024
2 parents 0505e32 + 9d4faef commit 051c1b3
Show file tree
Hide file tree
Showing 72 changed files with 8,929 additions and 0 deletions.
258 changes: 258 additions & 0 deletions budget_control/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,258 @@
==============
Budget Control
==============

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:353c8401879120bf194a5135e6f67838a807a00dc09ec0d8388ce36d90910040
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Alpha-red.png
:target: https://odoo-community.org/page/development-status
:alt: Alpha
.. |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-ecosoft--odoo%2Fbudgeting-lightgray.png?logo=github
:target: https://github.com/ecosoft-odoo/budgeting/tree/16.0/budget_control
:alt: ecosoft-odoo/budgeting

|badge1| |badge2| |badge3|

This module is the main module from a set of budget control modules.
This module alone will allow you to work in full cycle of budget control process.
Other modules, each one are the small enhancement of this module, to fullfill
additional needs. Having said that, following will describe the full cycle of budget
control already provided by this module,

Budget Control Core Features:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

* **Budget Commitment (base.budget.move)**

Probably the most crucial part of budget_control.

* Budget Balance = Budget Allocated - (Budget Actuals - Budget Commitments)

Actual amount are from `account.move.line` from posted invoice. Commitments can be sales/purchase,
expense, purchase request, etc. Document required to be budget commitment can extend base.budget.move.
For example, the module budget_control_expense will create budget commitment `expense.budget.move`
for approved expense.
Note that, in this budget_control module, there is no extension for budget commitment yet.

* **Budget Template (budget.template)**

A Budget Template in the budget control system serves as a framework for controlling the budget,
allowing for the budget to be managed according to the pre-defined template.
The budget template has a relationship with the accounting,
and is used to control spending based on pre-configured accounts.

* **Budget Period (budget.period)**

Budget Period is the first thing to do for new budget year, and is used to govern how budget will be
controlled over the defined date range, i.e.,

* Duration of budget year
* Template to control (budget.template)
* Document to do budget checking
* Analytic account in controlled
* Control Level

Although not mandatory, an organization will most likely use fiscal year as budget period.
In such case, there will be 1 budget period per fiscal year, and multiple budget control sheet (one per analytic).

* **Budget Control Sheet (budget.control)**

Each analytic account can have one budget control sheet per budget period.
The budget control is used to allocate budget amount in a simpler way.
In the backend it simply create budget.control.line, nothing too fancy.
Once we have budget allocations, the system is ready to perform budget check.

* **Budget Checking**

By calling function -- check_budget(), system will check whether the confirmation
of such document can result in negative budget balance. If so, it throw error message.
In this module, budget check occur during posting of invoice and journal entry.
To check budget also on more documents, do install budget_control_xxx relevant to that document.

* **Budget Constraint**

To make the function -- check_budget() more flexible,
additional rules or limitations can be added to the budget checking process.
The system will perform the regular budget check and will also check the additional conditions specified
in the added rules. An example of using budget constraints can be seen from the budget_allocation module.

* **Budget Reports**

Currently there are 2 types of report.

1. Budget Monitoring: combine all budget related transactions, and show them in Standard Odoo BI view.
2. Actual Budget Moves: combine all actual commit transactions, and show them in Standard Odoo BI view.

* **Budget Commitment Move Forward**

In case budget commitment is being used. Sometime user has committed budget withing this year
but not ready to use it and want to move the commitment amount to next year budget.
Budget Commitment Forward can be use to change the budget move's date to the designated year.

* **Budget Transfer**

This module allow transferring allocated budget from one budget control sheet to other


Extended Modules:
~~~~~~~~~~~~~~~~~

Following are brief explanation of what the extended module will do.

**Budget Move extension**

These modules extend base.budget.move for other document budget commitment.

* budget_control_expense
* budget_control_purchase
* budget_control_purchase_request
* budget_control_sale

**Budget Allocation**

This module is the main module for manage allocation (source of fund, analytic tag and analytic account)
until set budget control. and allow create Master Data source of fund, analytic tag dimension.
Users can view source of fund monitoring report

* budget_allocation

**Tier Validation**

Extend base_tier_validation for budget control sheet

* budget_control_tier_validation

**Analytic Tag Dimension Enhancements**

When 1 dimension (analytic account) is not enough,
we can use dimension to create persistent dimension columns

- analytic_tag_dimension
- analytic_tag_dimension_enhanced

Following modules ensure that, analytic_tag_dimension will work with all new
budget control objects. These are important for reporting purposes.

* budget_allocation
* budget_allocation_expense
* budget_allocation_purchase

.. IMPORTANT::
This is an alpha version, the data model and design can change at any time without warning.
Only for development or testing purpose, do not use in production.
`More details on development status <https://odoo-community.org/page/development-status>`_

**Table of contents**

.. contents::
:local:

Usage
=====

Before start using this module, following access right must be set.
- Budget User for Budget Control Sheet, Budget Report
- Budget Manager for Budget Period

Followings are sample steps to start with,

1. Create new Budget KPI

To create budget KPI using in budget template

2. Create new Budget Template

- Add new template for controlling Budget following kpi-account

3. Create new Budget Period

- Choose Budget template
- Identify date range, i.e., 1 fiscal year
- Plan Date Range, i.e., Quarter, the slot to fill allocation in budget control will split by quarter
- Control Budget = True (if not check = not check budget for this period)

4. Create Budget Control Sheet

To create budget control sheet, you can either create manually one by one or by using the helper,
Action > Create Budget Control Sheet

- Choose Analytic budget_control_purchase_tag_dimension
- Check All Analytic Account, this will list all analytic account in selected groups
- Uncheck Initial Budget By Commitment, this is used only on following year to
init budget allocation if they were committed amount carried over.
- Click "Create Budget Control Sheet", and then view the newly created control sheets.

5. Allocate amount in Budget Control Sheets

Each analytic account will have its own sheet. Form Budget Period, click on the
icon "Budget Control Sheets" or by Menu > Budgeting > Budget Control Sheet, to open them.

- Based on "Plan Date Range" period, Plan table will show all KPI split by Plan Date Range
- Allocate budget amount as appropriate.
- Click Control button, state will change to Controlled.

Note: Make sure the Plan Date Rang period already has date ranges that covers entire budget period.
Once ready, you can click on "Reset Plan" anytime.

6. Budget Reports

After some document transaction (i.e., invoice for actuals), you can view report anytime.

- On Budget Control sheet, click on Monitoring for see this budget report
- Menu Budgeting > Budget Monitoring, to show budget report in standard Odoo BI view.

7. Budget Checking

As we have checked Control Budget = True in third step, checking will occur
every time an invoice is validated. You can test by validate invoice with big amount to exceed.

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/ecosoft-odoo/budgeting/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/ecosoft-odoo/budgeting/issues/new?body=module:%20budget_control%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
~~~~~~~

* Ecosoft

Contributors
~~~~~~~~~~~~

* Kitti Upariphutthiphong <kittiu@ecosoft.co.th>
* Saran Lim. <saranl@ecosoft.co.th>

Maintainers
~~~~~~~~~~~

.. |maintainer-kittiu| image:: https://github.com/kittiu.png?size=40px
:target: https://github.com/kittiu
:alt: kittiu
.. |maintainer-ru3ix-bbb| image:: https://github.com/ru3ix-bbb.png?size=40px
:target: https://github.com/ru3ix-bbb
:alt: ru3ix-bbb

Current maintainers:

|maintainer-kittiu| |maintainer-ru3ix-bbb|

This module is part of the `ecosoft-odoo/budgeting <https://github.com/ecosoft-odoo/budgeting/tree/16.0/budget_control>`_ project on GitHub.

You are welcome to contribute.
5 changes: 5 additions & 0 deletions budget_control/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from . import models
from . import report
from . import wizards
from .hooks import update_data_hooks, uninstall_hook
58 changes: 58 additions & 0 deletions budget_control/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Copyright 2020 Ecosoft Co., Ltd. (http://ecosoft.co.th)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

{
"name": "Budget Control",
"version": "16.0.1.0.0",
"category": "Accounting",
"license": "AGPL-3",
"author": "Ecosoft, Odoo Community Association (OCA)",
"website": "https://github.com/ecosoft-odoo/budgeting",
"depends": [
"account",
"l10n_generic_coa",
"date_range",
"web_widget_x2many_2d_matrix",
],
"data": [
"data/sequence_data.xml",
"security/budget_control_security_groups.xml",
"security/budget_control_rules.xml",
"security/ir.model.access.csv",
"wizards/generate_budget_control_view.xml",
"wizards/analytic_budget_info_view.xml",
"wizards/analytic_budget_edit_view.xml",
"wizards/confirm_state_budget_view.xml",
"wizards/budget_commit_forward_info_view.xml",
"wizards/budget_balance_forward_info_view.xml",
"views/account_budget_move.xml",
"views/budget_menuitem.xml",
"views/budget_kpi_view.xml",
"views/budget_template_view.xml",
"views/res_config_settings_views.xml",
"views/budget_period_view.xml",
"views/budget_constraint_view.xml",
"views/budget_control_view.xml",
"views/analytic_account_views.xml",
"views/account_move_views.xml",
"views/account_journal_view.xml",
"views/budget_balance_forward_view.xml",
"views/budget_commit_forward_view.xml",
"views/budget_transfer_view.xml",
"views/budget_transfer_item_view.xml",
"views/budget_move_adjustment_view.xml",
"report/budget_monitor_report_view.xml",
"report/budget_move_views.xml",
],
"demo": ["demo/budget_template_demo.xml"],
"assets": {
"web.assets_backend": [
"budget_control/static/src/xml/budget_popover.xml",
],
},
"installable": True,
"maintainers": ["kittiu", "ru3ix-bbb"],
"post_init_hook": "update_data_hooks",
"uninstall_hook": "uninstall_hook",
"development_status": "Alpha",
}
17 changes: 17 additions & 0 deletions budget_control/data/sequence_data.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo noupdate="1">
<record id="seq_budget_transfer" model="ir.sequence">
<field name="name">Budget Transfer</field>
<field name="code">budget.transfer</field>
<field name="prefix">BT/%(year)s/</field>
<field name="padding">5</field>
<field name="company_id" eval="False" />
</record>
<record id="seq_budget_move_adjust" model="ir.sequence">
<field name="name">Budget Move Adjustment</field>
<field name="code">budget.move.adjustment</field>
<field name="prefix">BA/%(year)s/</field>
<field name="padding">5</field>
<field name="company_id" eval="False" />
</record>
</odoo>
37 changes: 37 additions & 0 deletions budget_control/demo/budget_template_demo.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo noupdate="1">
<!-- Add KPIs -->
<record id="budget_kpi1_demo" model="budget.kpi">
<field name="name">Expense</field>
</record>
<record id="budget_kpi2_demo" model="budget.kpi">
<field name="name">Purchase of Equipments</field>
</record>
<record id="budget_kpi3_demo" model="budget.kpi">
<field name="name">Rent</field>
</record>
<!-- Add Template -->
<record id="budget_template_demo" model="budget.template">
<field name="name">Budget Template (demo)</field>
</record>
<!-- Add Template Lines -->
<record id="budget_template_line_demo_kpi_600000" model="budget.template.line">
<field name="kpi_id" eval="ref('budget_control.budget_kpi1_demo')" />
<field name="account_ids" eval="[(4, ref('l10n_generic_coa.expense'))]" />
<field name="template_id" eval="ref('budget_control.budget_template_demo')" />
</record>
<record id="budget_template_line_demo_kpi_611000" model="budget.template.line">
<field name="kpi_id" ref="budget_control.budget_kpi2_demo" />
<field
name="account_ids"
eval="[(4, ref('l10n_generic_coa.expense_invest'))]"
/>
<field name="template_id" eval="ref('budget_control.budget_template_demo')" />
</record>
<record id="budget_template_line_demo_kpi_612000" model="budget.template.line">
<field name="kpi_id" ref="budget_control.budget_kpi3_demo" />
<field name="account_ids" eval="[(4, ref('l10n_generic_coa.expense_rent'))]" />
<field name="template_id" eval="ref('budget_control.budget_template_demo')" />
</record>

</odoo>
Loading

0 comments on commit 051c1b3

Please sign in to comment.