From 36dc7bd55e3d3284eabaa13e79d0ecf41bb45d3f Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Fri, 17 Nov 2023 17:34:21 +0530 Subject: [PATCH 1/5] refactor: convert payment reconciliation tool to virtual doctype (cherry picked from commit 3a51a3f37ecd70c13cee558a0b882d06e812a21c) # Conflicts: # erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.json --- .../payment_reconciliation/payment_reconciliation.json | 8 +++++++- .../payment_reconciliation_allocation.json | 3 ++- .../payment_reconciliation_invoice.json | 3 ++- .../payment_reconciliation_payment.json | 3 ++- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.json b/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.json index 0dc9c135b8c..19b146494c1 100644 --- a/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.json +++ b/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.json @@ -203,9 +203,10 @@ ], "hide_toolbar": 1, "icon": "icon-resize-horizontal", + "is_virtual": 1, "issingle": 1, "links": [], - "modified": "2023-08-15 05:35:50.109290", + "modified": "2023-11-17 17:33:55.701726", "modified_by": "Administrator", "module": "Accounts", "name": "Payment Reconciliation", @@ -230,6 +231,11 @@ ], "sort_field": "modified", "sort_order": "DESC", +<<<<<<< HEAD "states": [], "track_changes": 1 } +======= + "states": [] +} +>>>>>>> 3a51a3f37e (refactor: convert payment reconciliation tool to virtual doctype) diff --git a/erpnext/accounts/doctype/payment_reconciliation_allocation/payment_reconciliation_allocation.json b/erpnext/accounts/doctype/payment_reconciliation_allocation/payment_reconciliation_allocation.json index 5b8556e7c83..491c67818df 100644 --- a/erpnext/accounts/doctype/payment_reconciliation_allocation/payment_reconciliation_allocation.json +++ b/erpnext/accounts/doctype/payment_reconciliation_allocation/payment_reconciliation_allocation.json @@ -159,9 +159,10 @@ "label": "Difference Posting Date" } ], + "is_virtual": 1, "istable": 1, "links": [], - "modified": "2023-10-23 10:44:56.066303", + "modified": "2023-11-17 17:33:38.612615", "modified_by": "Administrator", "module": "Accounts", "name": "Payment Reconciliation Allocation", diff --git a/erpnext/accounts/doctype/payment_reconciliation_invoice/payment_reconciliation_invoice.json b/erpnext/accounts/doctype/payment_reconciliation_invoice/payment_reconciliation_invoice.json index c4dbd7e8441..7c9d49e7731 100644 --- a/erpnext/accounts/doctype/payment_reconciliation_invoice/payment_reconciliation_invoice.json +++ b/erpnext/accounts/doctype/payment_reconciliation_invoice/payment_reconciliation_invoice.json @@ -71,9 +71,10 @@ "label": "Exchange Rate" } ], + "is_virtual": 1, "istable": 1, "links": [], - "modified": "2022-11-08 18:18:02.502149", + "modified": "2023-11-17 17:33:45.455166", "modified_by": "Administrator", "module": "Accounts", "name": "Payment Reconciliation Invoice", diff --git a/erpnext/accounts/doctype/payment_reconciliation_payment/payment_reconciliation_payment.json b/erpnext/accounts/doctype/payment_reconciliation_payment/payment_reconciliation_payment.json index 17f3900880c..d199236ae99 100644 --- a/erpnext/accounts/doctype/payment_reconciliation_payment/payment_reconciliation_payment.json +++ b/erpnext/accounts/doctype/payment_reconciliation_payment/payment_reconciliation_payment.json @@ -107,9 +107,10 @@ "options": "Cost Center" } ], + "is_virtual": 1, "istable": 1, "links": [], - "modified": "2023-09-03 07:43:29.965353", + "modified": "2023-11-17 17:33:34.818530", "modified_by": "Administrator", "module": "Accounts", "name": "Payment Reconciliation Payment", From c349c89ae31505cd2993c7512356b4f8ef069b7c Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Sat, 18 Nov 2023 07:48:15 +0530 Subject: [PATCH 2/5] refactor: virtual doctype methods (cherry picked from commit 9c7b19e0b7732189c9db12e2c67b12a67fe562b3) --- .../payment_reconciliation.py | 52 +++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py b/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py index d2c75111edd..a907dc7acf5 100644 --- a/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py +++ b/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py @@ -29,6 +29,58 @@ class PaymentReconciliation(Document): self.accounting_dimension_filter_conditions = [] self.ple_posting_date_filter = [] + def load_from_db(self): + # 'modified' attribute is required for `run_doc_method` to work properly. + doc_dict = frappe._dict( + { + "modified": None, + "company": None, + "party": None, + "party_type": None, + "receivable_payable_account": None, + "default_advance_account": None, + "from_invoice_date": None, + "to_invoice_date": None, + "invoice_limit": 50, + "from_payment_date": None, + "to_payment_date": None, + "payment_limit": 50, + "minimum_invoice_amount": None, + "minimum_payment_amount": None, + "maximum_invoice_amount": None, + "maximum_payment_amount": None, + "bank_cash_account": None, + "cost_center": None, + "payment_name": None, + "invoice_name": None, + } + ) + super(Document, self).__init__(doc_dict) + + def save(self): + return + + @staticmethod + def get_list(args): + pass + + @staticmethod + def get_count(args): + pass + + @staticmethod + def get_stats(args): + pass + + def db_insert(self, *args, **kwargs): + pass + + def db_update(self, *args, **kwargs): + pass + + def delete(self): + pass + @frappe.whitelist() def get_unreconciled_entries(self): self.get_nonreconciled_payment_entries() From 454d789232ebcdc1b508c6b14d0d7d30c721361b Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Sat, 18 Nov 2023 08:07:36 +0530 Subject: [PATCH 3/5] chore: remove reconciliation defaults from patch (cherry picked from commit b5dd0c8630c59cc38011039e7c7a21976b53ebd8) # Conflicts: # erpnext/patches.txt --- erpnext/patches.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/erpnext/patches.txt b/erpnext/patches.txt index b8cda748509..56aca635a8f 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -344,10 +344,13 @@ erpnext.patches.v14_0.migrate_deferred_accounts_to_item_defaults erpnext.patches.v14_0.create_accounting_dimensions_in_sales_order_item erpnext.patches.v14_0.rename_over_order_allowance_field erpnext.patches.v14_0.migrate_delivery_stop_lock_field +<<<<<<< HEAD execute:frappe.db.set_single_value("Payment Reconciliation", "invoice_limit", 50) execute:frappe.db.set_single_value("Payment Reconciliation", "payment_limit", 50) erpnext.patches.v14_0.rename_daily_depreciation_to_depreciation_amount_based_on_num_days_in_month erpnext.patches.v14_0.rename_depreciation_amount_based_on_num_days_in_month_to_daily_prorata_based +======= +>>>>>>> b5dd0c8630 (chore: remove reconciliation defaults from patch) erpnext.patches.v14_0.add_default_for_repost_settings erpnext.patches.v14_0.create_accounting_dimensions_in_supplier_quotation erpnext.patches.v14_0.update_zero_asset_quantity_field From 59773acdd2d43e840b6a6ccb3b6ffca602e93af2 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Sat, 18 Nov 2023 08:10:09 +0530 Subject: [PATCH 4/5] chore: clear singles table and reconciliation related tables (cherry picked from commit f31002636bf21a3599ee5a7372db4d0cb3dbfad9) # Conflicts: # erpnext/patches.txt --- erpnext/patches.txt | 7 +++++++ .../clear_reconciliation_values_from_singles.py | 17 +++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 erpnext/patches/v14_0/clear_reconciliation_values_from_singles.py diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 56aca635a8f..bf3c6291c4a 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -352,8 +352,15 @@ erpnext.patches.v14_0.rename_depreciation_amount_based_on_num_days_in_month_to_d ======= >>>>>>> b5dd0c8630 (chore: remove reconciliation defaults from patch) erpnext.patches.v14_0.add_default_for_repost_settings +<<<<<<< HEAD erpnext.patches.v14_0.create_accounting_dimensions_in_supplier_quotation erpnext.patches.v14_0.update_zero_asset_quantity_field execute:frappe.db.set_single_value("Buying Settings", "project_update_frequency", "Each Transaction") +======= +erpnext.patches.v14_0.clear_reconciliation_values_from_singles +erpnext.patches.v15_0.rename_daily_depreciation_to_depreciation_amount_based_on_num_days_in_month +erpnext.patches.v15_0.rename_depreciation_amount_based_on_num_days_in_month_to_daily_prorata_based +erpnext.patches.v15_0.set_reserved_stock_in_bin +>>>>>>> f31002636b (chore: clear singles table and reconciliation related tables) # below migration patch should always run last erpnext.patches.v14_0.migrate_gl_to_payment_ledger diff --git a/erpnext/patches/v14_0/clear_reconciliation_values_from_singles.py b/erpnext/patches/v14_0/clear_reconciliation_values_from_singles.py new file mode 100644 index 00000000000..c1f5b60a406 --- /dev/null +++ b/erpnext/patches/v14_0/clear_reconciliation_values_from_singles.py @@ -0,0 +1,17 @@ +from frappe import qb + + +def execute(): + """ + Clear `tabSingles` and Payment Reconciliation tables of values + """ + singles = qb.DocType("Singles") + qb.from_(singles).delete().where(singles.doctype == "Payment Reconciliation").run() + doctypes = [ + "Payment Reconciliation Invoice", + "Payment Reconciliation Payment", + "Payment Reconciliation Allocation", + ] + for x in doctypes: + dt = qb.DocType(x) + qb.from_(dt).delete().run() From d27e588672fb854c21502f5c81f91b19f6119afc Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Mon, 4 Dec 2023 12:17:28 +0530 Subject: [PATCH 5/5] chore: resolve conflicts --- .../payment_reconciliation.json | 6 ------ erpnext/patches.txt | 11 ----------- 2 files changed, 17 deletions(-) diff --git a/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.json b/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.json index 19b146494c1..e8985de4e1e 100644 --- a/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.json +++ b/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.json @@ -231,11 +231,5 @@ ], "sort_field": "modified", "sort_order": "DESC", -<<<<<<< HEAD - "states": [], - "track_changes": 1 -} -======= "states": [] } ->>>>>>> 3a51a3f37e (refactor: convert payment reconciliation tool to virtual doctype) diff --git a/erpnext/patches.txt b/erpnext/patches.txt index bf3c6291c4a..94e3569abcf 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -344,23 +344,12 @@ erpnext.patches.v14_0.migrate_deferred_accounts_to_item_defaults erpnext.patches.v14_0.create_accounting_dimensions_in_sales_order_item erpnext.patches.v14_0.rename_over_order_allowance_field erpnext.patches.v14_0.migrate_delivery_stop_lock_field -<<<<<<< HEAD -execute:frappe.db.set_single_value("Payment Reconciliation", "invoice_limit", 50) -execute:frappe.db.set_single_value("Payment Reconciliation", "payment_limit", 50) erpnext.patches.v14_0.rename_daily_depreciation_to_depreciation_amount_based_on_num_days_in_month erpnext.patches.v14_0.rename_depreciation_amount_based_on_num_days_in_month_to_daily_prorata_based -======= ->>>>>>> b5dd0c8630 (chore: remove reconciliation defaults from patch) erpnext.patches.v14_0.add_default_for_repost_settings -<<<<<<< HEAD erpnext.patches.v14_0.create_accounting_dimensions_in_supplier_quotation erpnext.patches.v14_0.update_zero_asset_quantity_field execute:frappe.db.set_single_value("Buying Settings", "project_update_frequency", "Each Transaction") -======= erpnext.patches.v14_0.clear_reconciliation_values_from_singles -erpnext.patches.v15_0.rename_daily_depreciation_to_depreciation_amount_based_on_num_days_in_month -erpnext.patches.v15_0.rename_depreciation_amount_based_on_num_days_in_month_to_daily_prorata_based -erpnext.patches.v15_0.set_reserved_stock_in_bin ->>>>>>> f31002636b (chore: clear singles table and reconciliation related tables) # below migration patch should always run last erpnext.patches.v14_0.migrate_gl_to_payment_ledger