mirror of
https://github.com/frappe/erpnext.git
synced 2026-08-11 05:31:48 +00:00
fix(accounts): fetch deferred invoice docs on non-empty sales_docs or purchase_docs in repost accounting ledger (backport #57753) (#57756)
Co-authored-by: Diptanil Saha <diptanil@frappe.io>
This commit is contained in:
@@ -473,19 +473,24 @@ 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 = frappe.db.get_all(
|
docs_with_deferred_revenue = ()
|
||||||
"Sales Invoice Item",
|
docs_with_deferred_expense = ()
|
||||||
filters={"parent": ["in", sales_docs], "docstatus": 1, "enable_deferred_revenue": True},
|
|
||||||
fields=["parent"],
|
|
||||||
as_list=1,
|
|
||||||
)
|
|
||||||
|
|
||||||
docs_with_deferred_expense = frappe.db.get_all(
|
if sales_docs:
|
||||||
"Purchase Invoice Item",
|
docs_with_deferred_revenue = frappe.db.get_all(
|
||||||
filters={"parent": ["in", purchase_docs], "docstatus": 1, "enable_deferred_expense": 1},
|
"Sales Invoice Item",
|
||||||
fields=["parent"],
|
filters={"parent": ["in", sales_docs], "docstatus": 1, "enable_deferred_revenue": True},
|
||||||
as_list=1,
|
fields=["parent"],
|
||||||
)
|
as_list=1,
|
||||||
|
)
|
||||||
|
|
||||||
|
if purchase_docs:
|
||||||
|
docs_with_deferred_expense = frappe.db.get_all(
|
||||||
|
"Purchase Invoice Item",
|
||||||
|
filters={"parent": ["in", purchase_docs], "docstatus": 1, "enable_deferred_expense": 1},
|
||||||
|
fields=["parent"],
|
||||||
|
as_list=1,
|
||||||
|
)
|
||||||
|
|
||||||
if docs_with_deferred_revenue or docs_with_deferred_expense:
|
if docs_with_deferred_revenue or docs_with_deferred_expense:
|
||||||
frappe.throw(
|
frappe.throw(
|
||||||
|
|||||||
Reference in New Issue
Block a user