Merge pull request #22231 from deepeshgarg007/financila_satement_immutable
fix: Handle cancelled entries in financial statements
diff --git a/erpnext/accounts/report/financial_statements.py b/erpnext/accounts/report/financial_statements.py
index 393c5d3..533685d 100644
--- a/erpnext/accounts/report/financial_statements.py
+++ b/erpnext/accounts/report/financial_statements.py
@@ -405,6 +405,7 @@
FROM `tabDistributed Cost Center`
WHERE cost_center IN %(cost_center)s
AND parent NOT IN %(cost_center)s
+ AND is_cancelled = 0
GROUP BY parent
) as DCC_allocation
WHERE company=%(company)s
@@ -417,6 +418,7 @@
where company=%(company)s
{additional_conditions}
and posting_date <= %(to_date)s
+ and is_cancelled = 0
{distributed_cost_center_query}
order by account, posting_date""".format(
additional_conditions=additional_conditions,