fix: Budget validation for main cost center

This commit is contained in:
Deepesh Garg
2022-10-30 19:33:27 +05:30
parent 92f2d9f99f
commit 4e26d42d17
3 changed files with 43 additions and 4 deletions

View File

@@ -128,6 +128,12 @@ def distribute_gl_based_on_cost_center_allocation(gl_map, precision=None):
new_gl_map = []
for d in gl_map:
cost_center = d.get("cost_center")
# Validate budget against main cost center
validate_expense_against_budget(
d, expense_amount=flt(d.debit, precision) - flt(d.credit, precision)
)
if cost_center and cost_center_allocation.get(cost_center):
for sub_cost_center, percentage in cost_center_allocation.get(cost_center, {}).items():
gle = copy.deepcopy(d)