mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-13 02:01:21 +00:00
refactor: handle 'no data' situation in patch
(cherry picked from commit 8e3bf7dc09)
This commit is contained in:
@@ -10,6 +10,7 @@ def get_advance_doctypes() -> list:
|
|||||||
|
|
||||||
|
|
||||||
def get_payments_with_so_po_reference() -> list:
|
def get_payments_with_so_po_reference() -> list:
|
||||||
|
advance_payment_entries = []
|
||||||
advance_doctypes = get_advance_doctypes()
|
advance_doctypes = get_advance_doctypes()
|
||||||
per = qb.DocType("Payment Entry Reference")
|
per = qb.DocType("Payment Entry Reference")
|
||||||
payments_with_reference = (
|
payments_with_reference = (
|
||||||
@@ -19,19 +20,21 @@ def get_payments_with_so_po_reference() -> list:
|
|||||||
.where(per.reference_doctype.isin(advance_doctypes) & per.docstatus.eq(1))
|
.where(per.reference_doctype.isin(advance_doctypes) & per.docstatus.eq(1))
|
||||||
.run()
|
.run()
|
||||||
)
|
)
|
||||||
pe = qb.DocType("Payment Entry")
|
if payments_with_reference:
|
||||||
advance_payment_entries = (
|
pe = qb.DocType("Payment Entry")
|
||||||
qb.from_(pe)
|
advance_payment_entries = (
|
||||||
.select(ConstantColumn("Payment Entry").as_("doctype"))
|
qb.from_(pe)
|
||||||
.select(pe.name)
|
.select(ConstantColumn("Payment Entry").as_("doctype"))
|
||||||
.where(pe.name.isin(payments_with_reference) & pe.docstatus.eq(1))
|
.select(pe.name)
|
||||||
.run(as_dict=True)
|
.where(pe.name.isin(payments_with_reference) & pe.docstatus.eq(1))
|
||||||
)
|
.run(as_dict=True)
|
||||||
|
)
|
||||||
|
|
||||||
return advance_payment_entries
|
return advance_payment_entries
|
||||||
|
|
||||||
|
|
||||||
def get_journals_with_so_po_reference() -> list:
|
def get_journals_with_so_po_reference() -> list:
|
||||||
|
advance_journal_entries = []
|
||||||
advance_doctypes = get_advance_doctypes()
|
advance_doctypes = get_advance_doctypes()
|
||||||
jea = qb.DocType("Journal Entry Account")
|
jea = qb.DocType("Journal Entry Account")
|
||||||
journals_with_reference = (
|
journals_with_reference = (
|
||||||
@@ -41,16 +44,17 @@ def get_journals_with_so_po_reference() -> list:
|
|||||||
.where(jea.reference_type.isin(advance_doctypes) & jea.docstatus.eq(1))
|
.where(jea.reference_type.isin(advance_doctypes) & jea.docstatus.eq(1))
|
||||||
.run()
|
.run()
|
||||||
)
|
)
|
||||||
je = qb.DocType("Journal Entry")
|
if journals_with_reference:
|
||||||
advance_payment_entries = (
|
je = qb.DocType("Journal Entry")
|
||||||
qb.from_(je)
|
advance_journal_entries = (
|
||||||
.select(ConstantColumn("Journal Entry").as_("doctype"))
|
qb.from_(je)
|
||||||
.select(je.name)
|
.select(ConstantColumn("Journal Entry").as_("doctype"))
|
||||||
.where(je.name.isin(journals_with_reference) & je.docstatus.eq(1))
|
.select(je.name)
|
||||||
.run(as_dict=True)
|
.where(je.name.isin(journals_with_reference) & je.docstatus.eq(1))
|
||||||
)
|
.run(as_dict=True)
|
||||||
|
)
|
||||||
|
|
||||||
return advance_payment_entries
|
return advance_journal_entries
|
||||||
|
|
||||||
|
|
||||||
def make_advance_ledger_entries(vouchers: list):
|
def make_advance_ledger_entries(vouchers: list):
|
||||||
|
|||||||
Reference in New Issue
Block a user