fix(accounts): validate cost center allocation child company

(cherry picked from commit 03cf8eaf98)
This commit is contained in:
nareshkannasln
2026-10-27 11:34:55 +00:00
committed by Mergify
parent c5ec3e6563
commit e730d0d020
@@ -151,6 +151,14 @@ class CostCenterAllocation(Document):
]
for d in self.allocation_percentages:
if frappe.get_cached_value("Cost Center", d.cost_center, "company") != self.company:
frappe.throw(
_("Row {0}: Cost Center {1} does not belong to Company {2}").format(
d.idx, d.cost_center, self.company
),
InvalidChildCostCenter,
)
if d.cost_center in main_cost_centers:
frappe.throw(
_(