refactor: move ignore ERR filters from SOA to General Ledger
This commit is contained in:
parent
91b913b5bb
commit
c077eda64e
@ -120,18 +120,6 @@ def get_statement_dict(doc, get_statement_dict=False):
|
|||||||
statement_dict = {}
|
statement_dict = {}
|
||||||
ageing = ""
|
ageing = ""
|
||||||
|
|
||||||
err_journals = None
|
|
||||||
if doc.report == "General Ledger" and doc.ignore_exchange_rate_revaluation_journals:
|
|
||||||
err_journals = frappe.db.get_all(
|
|
||||||
"Journal Entry",
|
|
||||||
filters={
|
|
||||||
"company": doc.company,
|
|
||||||
"docstatus": 1,
|
|
||||||
"voucher_type": ("in", ["Exchange Rate Revaluation", "Exchange Gain Or Loss"]),
|
|
||||||
},
|
|
||||||
as_list=True,
|
|
||||||
)
|
|
||||||
|
|
||||||
for entry in doc.customers:
|
for entry in doc.customers:
|
||||||
if doc.include_ageing:
|
if doc.include_ageing:
|
||||||
ageing = set_ageing(doc, entry)
|
ageing = set_ageing(doc, entry)
|
||||||
@ -144,8 +132,8 @@ def get_statement_dict(doc, get_statement_dict=False):
|
|||||||
)
|
)
|
||||||
|
|
||||||
filters = get_common_filters(doc)
|
filters = get_common_filters(doc)
|
||||||
if err_journals:
|
if doc.ignore_exchange_rate_revaluation_journals:
|
||||||
filters.update({"voucher_no_not_in": [x[0] for x in err_journals]})
|
filters.update({"ignore_err": True})
|
||||||
|
|
||||||
if doc.report == "General Ledger":
|
if doc.report == "General Ledger":
|
||||||
filters.update(get_gl_filters(doc, entry, tax_id, presentation_currency))
|
filters.update(get_gl_filters(doc, entry, tax_id, presentation_currency))
|
||||||
|
|||||||
@ -203,8 +203,14 @@ frappe.query_reports["General Ledger"] = {
|
|||||||
"fieldname": "show_remarks",
|
"fieldname": "show_remarks",
|
||||||
"label": __("Show Remarks"),
|
"label": __("Show Remarks"),
|
||||||
"fieldtype": "Check"
|
"fieldtype": "Check"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "ignore_err",
|
||||||
|
"label": __("Ignore Exchange Rate Revaluation Journals"),
|
||||||
|
"fieldtype": "Check"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -241,6 +241,19 @@ def get_conditions(filters):
|
|||||||
if filters.get("against_voucher_no"):
|
if filters.get("against_voucher_no"):
|
||||||
conditions.append("against_voucher=%(against_voucher_no)s")
|
conditions.append("against_voucher=%(against_voucher_no)s")
|
||||||
|
|
||||||
|
if filters.get("ignore_err"):
|
||||||
|
err_journals = frappe.db.get_all(
|
||||||
|
"Journal Entry",
|
||||||
|
filters={
|
||||||
|
"company": filters.get("company"),
|
||||||
|
"docstatus": 1,
|
||||||
|
"voucher_type": ("in", ["Exchange Rate Revaluation", "Exchange Gain Or Loss"]),
|
||||||
|
},
|
||||||
|
as_list=True,
|
||||||
|
)
|
||||||
|
if err_journals:
|
||||||
|
filters.update({"voucher_no_not_in": [x[0] for x in err_journals]})
|
||||||
|
|
||||||
if filters.get("voucher_no_not_in"):
|
if filters.get("voucher_no_not_in"):
|
||||||
conditions.append("voucher_no not in %(voucher_no_not_in)s")
|
conditions.append("voucher_no not in %(voucher_no_not_in)s")
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user