refactor: build dictionary for Journal
remove redundant filter
(cherry picked from commit 2144e0337d)
This commit is contained in:
@@ -40,10 +40,5 @@ frappe.query_reports["Cheques and Deposits Incorrectly cleared"] = {
|
|||||||
default: frappe.datetime.get_today(),
|
default: frappe.datetime.get_today(),
|
||||||
reqd: 1,
|
reqd: 1,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
fieldname: "include_pos_transactions",
|
|
||||||
label: __("Include POS Transactions"),
|
|
||||||
fieldtype: "Check",
|
|
||||||
},
|
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -40,24 +40,43 @@ def build_payment_entry_dict(row: dict) -> dict:
|
|||||||
return row_dict
|
return row_dict
|
||||||
|
|
||||||
|
|
||||||
|
def build_journal_entry_dict(row: dict) -> dict:
|
||||||
|
row_dict = frappe._dict()
|
||||||
|
row_dict.update(
|
||||||
|
{
|
||||||
|
"payment_document": row.get("doctype"),
|
||||||
|
"payment_entry": row.get("name"),
|
||||||
|
"posting_date": row.get("posting_date"),
|
||||||
|
"clearance_date": row.get("clearance_date"),
|
||||||
|
"debit": row.get("debit_in_account_currency"),
|
||||||
|
"credit": row.get("credit_in_account_currency"),
|
||||||
|
}
|
||||||
|
)
|
||||||
|
return row_dict
|
||||||
|
|
||||||
|
|
||||||
def build_data(filters):
|
def build_data(filters):
|
||||||
vouchers = get_amounts_not_reflected_in_system_for_bank_reconciliation_statement(filters)
|
vouchers = get_amounts_not_reflected_in_system_for_bank_reconciliation_statement(filters)
|
||||||
data = []
|
data = []
|
||||||
for x in vouchers:
|
for x in vouchers:
|
||||||
if x.doctype == "Payment Entry":
|
if x.doctype == "Payment Entry":
|
||||||
data.append(build_payment_entry_dict(x))
|
data.append(build_payment_entry_dict(x))
|
||||||
|
elif x.doctype == "Journal Entry":
|
||||||
|
data.append(build_journal_entry_dict(x))
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
|
||||||
def get_amounts_not_reflected_in_system_for_bank_reconciliation_statement(filters):
|
def get_amounts_not_reflected_in_system_for_bank_reconciliation_statement(filters):
|
||||||
je = qb.DocType("Journal Entry")
|
je = qb.DocType("Journal Entry")
|
||||||
jea = qb.DocType("Journal Entry Account")
|
jea = qb.DocType("Journal Entry Account")
|
||||||
|
doctype_name = ConstantColumn("Journal Entry")
|
||||||
|
|
||||||
journals = (
|
journals = (
|
||||||
qb.from_(je)
|
qb.from_(je)
|
||||||
.inner_join(jea)
|
.inner_join(jea)
|
||||||
.on(je.name == jea.parent)
|
.on(je.name == jea.parent)
|
||||||
.select(
|
.select(
|
||||||
|
doctype_name.as_("doctype"),
|
||||||
je.name,
|
je.name,
|
||||||
jea.debit_in_account_currency,
|
jea.debit_in_account_currency,
|
||||||
jea.credit_in_account_currency,
|
jea.credit_in_account_currency,
|
||||||
|
|||||||
Reference in New Issue
Block a user