OCA / account-budgeting

37 stars 113 forks source link

[12.0][ADD] budget_management [WIP] #32

Closed kittiu closed 4 years ago

kittiu commented 4 years ago

These module make use of module mis_buider_budget infrastructure for budget control, but add more features to

This PR consist of 3 addons

  1. budget_management: this addon provide main models for configuration.
    • budget.management - setup a data range (i.e., yearly) configuration of how budget will be controlled (by which KPI, analytic account and whether invoice to be controlled by which budget allocated)
    • budget.control - provide easier way to allocated budget items for each analytic account, by kpi vs time period
  2. budget_management_purchase: to consider purchase confirmation as another source of budget consumption (budget moves), and also lock budget during purchase confirm.
  3. budget_management_expense: to consider expense approved as another source of budget consumption (budget moves), and also lock budget during expense approval.
  4. budget_management_sale: to consider sales approved as another source of budget consumption (budget moves), but not locking as sales is always OK.
  5. budget_management_purchase_request: to consider PR approved as another source of budget consumption (budget moves), and also lock budget during PR approval.

Pending task in this PR

kittiu commented 4 years ago

Usage of budget_management

This module is the base of all the 3 addons in this PR. It targeted user who want to easily plan and strictly control budget at Analytic Account level.

For example, user want to control Project-A and Project-B on its expenses

Preparation

1. Create new Project-A and Project-B

> Invoicing > Configuration > Analytic Accounting > Analytic Account

image

2. Create KPIs (mis.report), i.e., for material expenses, and service expenses

> Invoicing > Configuration > MIS Report > MIS Report Template

Assume material expense and service expense refer to account code 5001 and 5002 respectively. As sample, I also create products that use those accounts for expense

Note: Make sure both KPI lines are budgetable

image

3. Create Budget Management for the control period, i.e., for fiscal 2019

> Budgeting > Budget Management > Budget Management

A Budget Management is used as configurator to manage budget for a set of KPI, of multiple projects (analytic account), for a set period of time.

Select the KPI Template form (2), and note that the new Budget (mis.budget) is auto created.

image

On budget management,

As budget.management also inherits mis.report.instance, as such, a new MIS Report and its required Columns for budget reporting is also created automatically.

image

At this point, if user try to confirm a vendor bill for Project-A or Project-B, system should not allow, as a budget control sheet for each project is not set. We should allocate the amount for both project first, to use the budget.

4. Create Budget Control Sheet

> Budgeting > Budget Management > Budget Control Sheet

User will create budget control and allocate amount for each project (analytic account).

From below picture, we have setup for Project-A to budget for material 6,000 and service 3,000. Repeat the same for Project-B.

image

Operation - Budget Check on Vendor Bill

1. Review current budget report

At this point, user can browse to MIS Report - FY2019, to see the overall budget report for both Project-A and Project-B as following,

image

But from the Budget Control - FY2019 for Project-A, click on Preview button will already show the current budget consumption report as follow, i.e., for Project-A, available amount for material and expense are 6,000 and 3,000 respectively.

image

2. Confirm vendor bill to test on budget check

Create a new Vendor Bill for Project-A and Project-B, and attempt to over budget for Project-A. The system will block user from validating document.

image

Fill in a reasonable amount and this document will pass the budget check. Now, go back to preview budget report again and see the actual amount being adjusted.

image

kittiu commented 4 years ago

Usage of budget_management_purchase, budget_management_expense

These 2 modules is used to expand the budget control to cover purchase and expense document. When confirm the 2 document, system will also log the budget moves and consider them as budget commitment in budget report.

Once the addons are installed, user will see more options,

image

On each document, i.e., Purchase Order, will create budget moves,

image

Those budget moves from Purchase and Expense will also reflect in budget reports, i.e., for Project-A

image

kittiu commented 4 years ago

Please feel free to leave your comment or feature request here. ;)

kittiu commented 4 years ago

Change module to budget_control, moved to https://github.com/OCA/account-budgeting/pull/35

lmignon commented 4 years ago

@kittiu All this work looks really promising. Thank you for this work. We have to manage public accounting for some of our clients and upon reading the description I have the feeling that our approach could benefit greatly from these addons. I will continue to investigate the code and see if I can find any areas of convergence. I am currently working on a proto in V13 which will not make things easy because mis-builder does not exist in v13...

kittiu commented 4 years ago

@lmignon glad that you are interested. There are more to come, i..e, close year end budget commitment carry over, budget transfer between costcenter (analytic), more dimensions for more budget monitoring report, etc. This PR will be deprecated, as I moved it here https://github.com/ecosoft-odoo/account-budgeting/tree/12.0-add-budget_control Sorry for no good document at the moment, but I plan to do it after I got the full picture. And will need a lot of comments.

We plan to use in v13 as well, but since no mis_builder, we also can't do. You can help expedite the v13 mis_buider, hehe.

hitrosol commented 4 years ago

Hi @kittiu, I'm interested to see this feature. I wonder if the budget management expense will consider the Approved / Paid Employee Advance as in https://github.com/OCA/hr/tree/12.0/hr_expense_advance_clearing as commitment as well. I use the analytical account when I request the Employee Advance in this module to recognize the budget in each Analytic Account. By considering this commitment, this will avoid over budget trap whenever the Employee clear the Advance.

kittiu commented 4 years ago

Hi @hitrosol In the previous organization we did (in v8), my customer said their old SAP do not consider advance as the commitment. Only expense does. They claim that, advance is just the amount being in employee pocket, not the real use. Accounting wise, we also agree it is correct that way.

BUT in the coming project we are doing, it seem that customer want to commit in Advance too. So...we are considering (initially we think it will be wrong). Do you have any reason behind your argument? especially on accounting basis. cc @wipawii

hitrosol commented 4 years ago

Hi @kittiu Thanks for considering this use case. Requester will think that all the expense spent after s/he get advance will be approved whenever s/he clear the advance as long as the actual spending will be less than the advance per Analytic Account. It will be surprise if s/he can't clear the advance because the commitment hans't consider this amount.

I also found some situation where the reallocation of the expense is conducted through the Journal Entries. Will you put the budget validation in Journal Entries whenever user Approve it ?

Good job for this module :)

kittiu commented 4 years ago

Hi @hitrosol

Yes, we check on account.move - post(). So, it will cover the case.

For hr_expense_advance_clearing. We agree to make it work on hr advance also. It will cover both cases in the future.

You have project or experiences with public budgeting?

Thank you for your comment. As this progress, would love more comment from you.

kittiu commented 4 years ago

By the way, this PR is closed, as I want to move discuss here to the issue. In future, let's discuss there :) https://github.com/OCA/account-budgeting/issues/36