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

feat: Cost Center Allocation #29536

Merged
merged 9 commits into from
Jan 31, 2022

Conversation

nabinhait
Copy link
Member

@nabinhait nabinhait commented Jan 31, 2022

Cost Center Allocation

Cost Center Allocation is a feature using which the general ledger entry against a cost center can be split against multiple cost centers. In the Cost Center Allocation document, you can define allocation percentages of the child cost centers.

In a growing business, it becomes a necessity to analyse the income/expenses against each business unit of the organisation. And to do that, we need to treat each businees unit as a cost center and book income/expenses against the cost center. But if we need to split it every time at the transaction level manually, it becomes very difficult. That's when this Cost Center Allocation feature comes to the rescue.

In ERPNext, we just need to define the allocation between multiple cost centers for a specific master/main cost center. Then whenever we book an invoice or expense transaction against the main cost center, the system automatically split it based on allocation and posts gl entries against each child cost center.

cost-center-allocation

GL Entries against Transaction

While booking any transaction against the main cost center, the system automatically split the GL Entry against it and posts multiple gl entries based on the applicable cost center allocation record.

general-ledger-based-on-cost-center-allocation

(GL Entries against a Sales Invoice has been splitted based on Cost Center Allocation)

What changed from the earlier Distributed Cost Center?

In version 13, we have a feature called Distributed Cost Center using which you can define the allocation percentages between multiple cost centers. Earlier, we used to do it inside Cost Center master. Based on the allocation, we used to get the multiple financial reports based on the distribution, but it had no effect in the actual GL Entries.
It has certain drawbacks, like it does not take care of changes in the distribution overtime. In the real world, cost center allocation keeps changing over time and based on updated allocation, system should book income/expenses against it. It cannot be calculated run-time.

Patch

A patch has been written to migrate the data from old system to the new.

Docs

https://docs.erpnext.com/docs/v13/user/manual/en/accounts/new?wiki_page_patch=fee1a96a05

Test Cases:

  • Validations:

    • Total allocation percentage is 100
    • From Date must be after last gl entry against main cost center
    • Main cost center cannot be entered as a child
    • Main cost center cannot be used in other allocations as child
    • Child cost center is not used in other allocation as the main
  • Logic:

    • Multiple GL Entries are posted based on allocation
  • Reports:

    • Code related to the old distributed cost center has been deleted from the following reports, hence needs manual testing.
      • Financial Statements
      • General Ledger
      • Profitability Analysis
      • Budget Variance Report

@nabinhait nabinhait force-pushed the cost-center-allocation branch from b93e12e to 9a7ea9d Compare January 31, 2022 12:02
@nabinhait nabinhait force-pushed the cost-center-allocation branch from 9a7ea9d to 6099af5 Compare January 31, 2022 12:13
@codecov
Copy link

codecov bot commented Jan 31, 2022

Codecov Report

Merging #29536 (5b0ec64) into develop (05bbb69) will increase coverage by 0.24%.
The diff coverage is 87.71%.

@@             Coverage Diff             @@
##           develop   #29536      +/-   ##
===========================================
+ Coverage    58.06%   58.31%   +0.24%     
===========================================
  Files         1096     1097       +1     
  Lines        68778    68812      +34     
===========================================
+ Hits         39934    40125     +191     
+ Misses       28844    28687     -157     
Impacted Files Coverage Δ
...t/budget_variance_report/budget_variance_report.py 0.00% <ø> (ø)
erpnext/accounts/report/financial_statements.py 35.76% <0.00%> (+0.78%) ⬆️
...t/profitability_analysis/profitability_analysis.py 0.00% <ø> (ø)
...rpnext/accounts/doctype/cost_center/cost_center.py 39.24% <22.22%> (-1.39%) ⬇️
erpnext/accounts/general_ledger.py 94.39% <91.22%> (+0.40%) ⬆️
...e/cost_center_allocation/cost_center_allocation.py 97.77% <97.77%> (ø)
...on_percentage/cost_center_allocation_percentage.py 100.00% <100.00%> (ø)
...t/accounts/report/general_ledger/general_ledger.py 61.43% <100.00%> (+1.83%) ⬆️
...eport/item_variant_details/item_variant_details.py 31.32% <0.00%> (-53.02%) ⬇️
.../report/delayed_item_report/delayed_item_report.py 60.78% <0.00%> (-35.30%) ⬇️
... and 39 more

@nabinhait nabinhait force-pushed the cost-center-allocation branch from 99a1f91 to 28bd931 Compare January 31, 2022 13:06
@nabinhait nabinhait force-pushed the cost-center-allocation branch from 28bd931 to 5b0ec64 Compare January 31, 2022 13:11
@deepeshgarg007 deepeshgarg007 merged commit dcd99a8 into frappe:develop Jan 31, 2022
@sammish
Copy link
Contributor

sammish commented Apr 4, 2022

@nabinhait
congratulations Nice change "Valid From "
image

@jigneshpshah
Copy link
Contributor

How can this https://docs.erpnext.com/docs/v14/user/manual/en/accounts/distributed-cost-center be deleted ?

As distributed cost center is no more available in v14.
As such it was a good feature to view the Financial Statements based on the likely distribution % ! :-)

@sammish
Copy link
Contributor

sammish commented Feb 14, 2023

@jigneshpshah Its available in v14 which called cost center allocation

@jigneshpshah
Copy link
Contributor

@sammish please read my comments again 😃

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 31, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants