fix(accounts): fetch deferred invoice docs on non-empty sales_docs or purchase_docs in repost accounting ledger (#57753)

This commit is contained in:
Diptanil Saha
2026-08-03 17:25:50 +05:30
committed by GitHub
parent 4babce436f
commit 6153202231

View File

@@ -467,6 +467,10 @@ def get_child_docs(doc: list) -> list:
def validate_docs_for_deferred_accounting(sales_docs, purchase_docs): def validate_docs_for_deferred_accounting(sales_docs, purchase_docs):
docs_with_deferred_revenue = ()
docs_with_deferred_expense = ()
if sales_docs:
docs_with_deferred_revenue = frappe.db.get_all( docs_with_deferred_revenue = frappe.db.get_all(
"Sales Invoice Item", "Sales Invoice Item",
filters={"parent": ["in", sales_docs], "docstatus": 1, "enable_deferred_revenue": True}, filters={"parent": ["in", sales_docs], "docstatus": 1, "enable_deferred_revenue": True},
@@ -474,6 +478,7 @@ def validate_docs_for_deferred_accounting(sales_docs, purchase_docs):
as_list=1, as_list=1,
) )
if purchase_docs:
docs_with_deferred_expense = frappe.db.get_all( docs_with_deferred_expense = frappe.db.get_all(
"Purchase Invoice Item", "Purchase Invoice Item",
filters={"parent": ["in", purchase_docs], "docstatus": 1, "enable_deferred_expense": 1}, filters={"parent": ["in", purchase_docs], "docstatus": 1, "enable_deferred_expense": 1},