refactor: ignore ERR journals in Statment of Accounts
(cherry picked from commit 39ef75e2d0f18aa8d7434297be596b9223aa7910)
This commit is contained in:
parent
4fe7988249
commit
5a807af505
@ -15,6 +15,7 @@
|
|||||||
"group_by",
|
"group_by",
|
||||||
"cost_center",
|
"cost_center",
|
||||||
"territory",
|
"territory",
|
||||||
|
"ignore_exchange_rate_revaluation_journals",
|
||||||
"column_break_14",
|
"column_break_14",
|
||||||
"to_date",
|
"to_date",
|
||||||
"finance_book",
|
"finance_book",
|
||||||
@ -376,10 +377,16 @@
|
|||||||
"fieldname": "pdf_name",
|
"fieldname": "pdf_name",
|
||||||
"fieldtype": "Data",
|
"fieldtype": "Data",
|
||||||
"label": "PDF Name"
|
"label": "PDF Name"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"default": "0",
|
||||||
|
"fieldname": "ignore_exchange_rate_revaluation_journals",
|
||||||
|
"fieldtype": "Check",
|
||||||
|
"label": "Ignore Exchange Rate Revaluation Journals"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2023-08-28 12:59:53.071334",
|
"modified": "2023-12-18 12:20:08.965120",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Accounts",
|
"module": "Accounts",
|
||||||
"name": "Process Statement Of Accounts",
|
"name": "Process Statement Of Accounts",
|
||||||
|
@ -56,6 +56,7 @@ class ProcessStatementOfAccounts(Document):
|
|||||||
frequency: DF.Literal["Weekly", "Monthly", "Quarterly"]
|
frequency: DF.Literal["Weekly", "Monthly", "Quarterly"]
|
||||||
from_date: DF.Date | None
|
from_date: DF.Date | None
|
||||||
group_by: DF.Literal["", "Group by Voucher", "Group by Voucher (Consolidated)"]
|
group_by: DF.Literal["", "Group by Voucher", "Group by Voucher (Consolidated)"]
|
||||||
|
ignore_exchange_rate_revaluation_journals: DF.Check
|
||||||
include_ageing: DF.Check
|
include_ageing: DF.Check
|
||||||
include_break: DF.Check
|
include_break: DF.Check
|
||||||
letter_head: DF.Link | None
|
letter_head: DF.Link | None
|
||||||
@ -119,6 +120,18 @@ 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)
|
||||||
@ -131,6 +144,8 @@ def get_statement_dict(doc, get_statement_dict=False):
|
|||||||
)
|
)
|
||||||
|
|
||||||
filters = get_common_filters(doc)
|
filters = get_common_filters(doc)
|
||||||
|
if err_journals:
|
||||||
|
filters.update({"voucher_no_not_in": [x[0] for x in err_journals]})
|
||||||
|
|
||||||
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))
|
||||||
|
@ -238,6 +238,9 @@ def get_conditions(filters):
|
|||||||
if filters.get("voucher_no"):
|
if filters.get("voucher_no"):
|
||||||
conditions.append("voucher_no=%(voucher_no)s")
|
conditions.append("voucher_no=%(voucher_no)s")
|
||||||
|
|
||||||
|
if filters.get("voucher_no_not_in"):
|
||||||
|
conditions.append("voucher_no not in %(voucher_no_not_in)s")
|
||||||
|
|
||||||
if filters.get("group_by") == "Group by Party" and not filters.get("party_type"):
|
if filters.get("group_by") == "Group by Party" and not filters.get("party_type"):
|
||||||
conditions.append("party_type in ('Customer', 'Supplier')")
|
conditions.append("party_type in ('Customer', 'Supplier')")
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user