From a9871e379a4374055466111d8fdd70a78e33cd93 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Tue, 13 Aug 2024 10:37:55 +0530 Subject: [PATCH 1/4] refactor: combine vouchers from both ignore (cherry picked from commit 4cc5cd5a71fbc434ca7e95b24b9b7a491840854a) --- erpnext/accounts/report/general_ledger/general_ledger.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/erpnext/accounts/report/general_ledger/general_ledger.py b/erpnext/accounts/report/general_ledger/general_ledger.py index 05bbc4a79c9..b7f035b1e80 100644 --- a/erpnext/accounts/report/general_ledger/general_ledger.py +++ b/erpnext/accounts/report/general_ledger/general_ledger.py @@ -246,7 +246,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") From 1ebcc33cdd3c3914ad82e9efac915f0472e064d6 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Tue, 13 Aug 2024 10:41:31 +0530 Subject: [PATCH 2/4] refactor: cr and dr note filter in Statement of Accounts (cherry picked from commit 0cf478c4c26f61b1e23195a27468f69cbb21b7b4) # Conflicts: # erpnext/accounts/doctype/process_statement_of_accounts/process_statement_of_accounts.json # erpnext/accounts/doctype/process_statement_of_accounts/process_statement_of_accounts.py --- .../process_statement_of_accounts.json | 11 ++++ .../process_statement_of_accounts.py | 57 +++++++++++++++++++ 2 files changed, 68 insertions(+) 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 bdbb1419784..0c7f8eb2aad 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", @@ -381,10 +382,20 @@ "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": [], +<<<<<<< HEAD "modified": "2023-12-18 12:20:08.965120", +======= + "modified": "2024-08-13 10:41:18.381165", +>>>>>>> 0cf478c4c2 (refactor: cr and dr note filter in Statement of Accounts) "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 a602e0d7df3..3daee8f430f 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 @@ -22,6 +22,63 @@ from erpnext.accounts.report.general_ledger.general_ledger import execute as get class ProcessStatementOfAccounts(Document): +<<<<<<< HEAD +======= + # begin: auto-generated types + # This code is auto-generated. Do not modify anything in this block. + + from typing import TYPE_CHECKING + + if TYPE_CHECKING: + from frappe.types import DF + + from erpnext.accounts.doctype.process_statement_of_accounts_customer.process_statement_of_accounts_customer import ( + ProcessStatementOfAccountsCustomer, + ) + from erpnext.accounts.doctype.psoa_cost_center.psoa_cost_center import PSOACostCenter + from erpnext.accounts.doctype.psoa_project.psoa_project import PSOAProject + + account: DF.Link | None + ageing_based_on: DF.Literal["Due Date", "Posting Date"] + based_on_payment_terms: DF.Check + body: DF.TextEditor | None + cc_to: DF.Link | None + collection_name: DF.DynamicLink | None + company: DF.Link + cost_center: DF.TableMultiSelect[PSOACostCenter] + currency: DF.Link | None + customer_collection: DF.Literal["", "Customer Group", "Territory", "Sales Partner", "Sales Person"] + customers: DF.Table[ProcessStatementOfAccountsCustomer] + enable_auto_email: DF.Check + filter_duration: DF.Int + finance_book: DF.Link | None + 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 + letter_head: DF.Link | None + orientation: DF.Literal["Landscape", "Portrait"] + payment_terms_template: DF.Link | None + pdf_name: DF.Data | None + posting_date: DF.Date | None + primary_mandatory: DF.Check + project: DF.TableMultiSelect[PSOAProject] + report: DF.Literal["General Ledger", "Accounts Receivable"] + sales_partner: DF.Link | None + sales_person: DF.Link | None + sender: DF.Link | None + show_net_values_in_party_account: DF.Check + start_date: DF.Date | None + subject: DF.Data | None + terms_and_conditions: DF.Link | None + territory: DF.Link | None + to_date: DF.Date | None + # end: auto-generated types + +>>>>>>> 0cf478c4c2 (refactor: cr and dr note filter in Statement of Accounts) def validate(self): if not self.subject: self.subject = "Statement Of Accounts for {{ customer.customer_name }}" From cef3573d7945dc9c3fbbbfbb26083e297b1b844a Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Tue, 13 Aug 2024 10:42:32 +0530 Subject: [PATCH 3/4] refactor: pass filter to General Ledger (cherry picked from commit 90880c8c01642cd40782f51c08d30d0896ac066e) --- .../process_statement_of_accounts.py | 3 +++ 1 file changed, 3 insertions(+) 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 3daee8f430f..7584b812053 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 @@ -136,6 +136,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) From e421e16fdc1f2e6ca46c36262a27e077d609dd5a Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Tue, 13 Aug 2024 11:22:52 +0530 Subject: [PATCH 4/4] chore: resolve conflicts --- .../process_statement_of_accounts.json | 4 -- .../process_statement_of_accounts.py | 57 ------------------- 2 files changed, 61 deletions(-) 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 0c7f8eb2aad..8584cbb31cb 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 @@ -391,11 +391,7 @@ } ], "links": [], -<<<<<<< HEAD - "modified": "2023-12-18 12:20:08.965120", -======= "modified": "2024-08-13 10:41:18.381165", ->>>>>>> 0cf478c4c2 (refactor: cr and dr note filter in Statement of Accounts) "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 7584b812053..078ac034eeb 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 @@ -22,63 +22,6 @@ from erpnext.accounts.report.general_ledger.general_ledger import execute as get class ProcessStatementOfAccounts(Document): -<<<<<<< HEAD -======= - # begin: auto-generated types - # This code is auto-generated. Do not modify anything in this block. - - from typing import TYPE_CHECKING - - if TYPE_CHECKING: - from frappe.types import DF - - from erpnext.accounts.doctype.process_statement_of_accounts_customer.process_statement_of_accounts_customer import ( - ProcessStatementOfAccountsCustomer, - ) - from erpnext.accounts.doctype.psoa_cost_center.psoa_cost_center import PSOACostCenter - from erpnext.accounts.doctype.psoa_project.psoa_project import PSOAProject - - account: DF.Link | None - ageing_based_on: DF.Literal["Due Date", "Posting Date"] - based_on_payment_terms: DF.Check - body: DF.TextEditor | None - cc_to: DF.Link | None - collection_name: DF.DynamicLink | None - company: DF.Link - cost_center: DF.TableMultiSelect[PSOACostCenter] - currency: DF.Link | None - customer_collection: DF.Literal["", "Customer Group", "Territory", "Sales Partner", "Sales Person"] - customers: DF.Table[ProcessStatementOfAccountsCustomer] - enable_auto_email: DF.Check - filter_duration: DF.Int - finance_book: DF.Link | None - 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 - letter_head: DF.Link | None - orientation: DF.Literal["Landscape", "Portrait"] - payment_terms_template: DF.Link | None - pdf_name: DF.Data | None - posting_date: DF.Date | None - primary_mandatory: DF.Check - project: DF.TableMultiSelect[PSOAProject] - report: DF.Literal["General Ledger", "Accounts Receivable"] - sales_partner: DF.Link | None - sales_person: DF.Link | None - sender: DF.Link | None - show_net_values_in_party_account: DF.Check - start_date: DF.Date | None - subject: DF.Data | None - terms_and_conditions: DF.Link | None - territory: DF.Link | None - to_date: DF.Date | None - # end: auto-generated types - ->>>>>>> 0cf478c4c2 (refactor: cr and dr note filter in Statement of Accounts) def validate(self): if not self.subject: self.subject = "Statement Of Accounts for {{ customer.customer_name }}"