diff --git a/erpnext/accounts/doctype/process_statement_of_accounts/process_statement_of_accounts.json b/erpnext/accounts/doctype/process_statement_of_accounts/process_statement_of_accounts.json index 4b2dd032b11ff07c493901ac746dc14b1b954954..e55cb368de454e0900a62671c3806e6a9743c937 100644 --- a/erpnext/accounts/doctype/process_statement_of_accounts/process_statement_of_accounts.json +++ b/erpnext/accounts/doctype/process_statement_of_accounts/process_statement_of_accounts.json @@ -16,6 +16,7 @@ "cost_center", "territory", "ignore_exchange_rate_revaluation_journals", + "ignore_cr_dr_notes", "column_break_14", "to_date", "finance_book", @@ -383,10 +384,16 @@ "fieldname": "ignore_exchange_rate_revaluation_journals", "fieldtype": "Check", "label": "Ignore Exchange Rate Revaluation Journals" + }, + { + "default": "0", + "fieldname": "ignore_cr_dr_notes", + "fieldtype": "Check", + "label": "Ignore System Generated Credit / Debit Notes" } ], "links": [], - "modified": "2023-12-18 12:20:08.965120", + "modified": "2024-08-13 10:41:18.381165", "modified_by": "Administrator", "module": "Accounts", "name": "Process Statement Of Accounts", diff --git a/erpnext/accounts/doctype/process_statement_of_accounts/process_statement_of_accounts.py b/erpnext/accounts/doctype/process_statement_of_accounts/process_statement_of_accounts.py index 4dcba5e3d0517b3cb35495d5d52f5a6967e7e474..509199ccae6460737f418d0f9cff9f4a0203eac1 100644 --- a/erpnext/accounts/doctype/process_statement_of_accounts/process_statement_of_accounts.py +++ b/erpnext/accounts/doctype/process_statement_of_accounts/process_statement_of_accounts.py @@ -46,9 +46,7 @@ class ProcessStatementOfAccounts(Document): company: DF.Link cost_center: DF.TableMultiSelect[PSOACostCenter] currency: DF.Link | None - customer_collection: DF.Literal[ - "", "Customer Group", "Territory", "Sales Partner", "Sales Person" - ] + customer_collection: DF.Literal["", "Customer Group", "Territory", "Sales Partner", "Sales Person"] customers: DF.Table[ProcessStatementOfAccountsCustomer] enable_auto_email: DF.Check filter_duration: DF.Int @@ -56,6 +54,7 @@ class ProcessStatementOfAccounts(Document): frequency: DF.Literal["Weekly", "Monthly", "Quarterly"] from_date: DF.Date | None group_by: DF.Literal["", "Group by Voucher", "Group by Voucher (Consolidated)"] + ignore_cr_dr_notes: DF.Check ignore_exchange_rate_revaluation_journals: DF.Check include_ageing: DF.Check include_break: DF.Check @@ -135,6 +134,9 @@ def get_statement_dict(doc, get_statement_dict=False): if doc.ignore_exchange_rate_revaluation_journals: filters.update({"ignore_err": True}) + if doc.ignore_cr_dr_notes: + filters.update({"ignore_cr_dr_notes": True}) + if doc.report == "General Ledger": filters.update(get_gl_filters(doc, entry, tax_id, presentation_currency)) col, res = get_soa(filters) @@ -406,9 +408,7 @@ def get_customer_emails(customer_name, primary_mandatory, billing_and_primary=Tr {mcond} ORDER BY contact.creation desc - """.format( - mcond=get_match_cond("Contact") - ), + """.format(mcond=get_match_cond("Contact")), customer_name, ) @@ -481,9 +481,7 @@ def send_emails(document_name, from_scheduler=False, posting_date=None): else: new_to_date = add_months(new_to_date, 1 if doc.frequency == "Monthly" else 3) new_from_date = add_months(new_to_date, -1 * doc.filter_duration) - doc.add_comment( - "Comment", "Emails sent on: " + frappe.utils.format_datetime(frappe.utils.now()) - ) + doc.add_comment("Comment", "Emails sent on: " + frappe.utils.format_datetime(frappe.utils.now())) if doc.report == "General Ledger": doc.db_set("to_date", new_to_date, commit=True) doc.db_set("from_date", new_from_date, commit=True) diff --git a/erpnext/accounts/report/general_ledger/general_ledger.py b/erpnext/accounts/report/general_ledger/general_ledger.py index 7d20588db221abded68b55ef6b8bd0d7e13ab1e9..4407371b41016babbdb83c530680e0417697ab87 100644 --- a/erpnext/accounts/report/general_ledger/general_ledger.py +++ b/erpnext/accounts/report/general_ledger/general_ledger.py @@ -296,7 +296,10 @@ def get_conditions(filters): as_list=True, ) if system_generated_cr_dr_journals: - filters.update({"voucher_no_not_in": [x[0] for x in system_generated_cr_dr_journals]}) + vouchers_to_ignore = (filters.get("voucher_no_not_in") or []) + [ + x[0] for x in system_generated_cr_dr_journals + ] + filters.update({"voucher_no_not_in": vouchers_to_ignore}) if filters.get("voucher_no_not_in"): conditions.append("voucher_no not in %(voucher_no_not_in)s")