From 2d14d92b32021f1a5af76eae8a7f83bfb06e58db Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Mon, 6 Mar 2023 20:59:34 +0530 Subject: [PATCH 01/13] fix: incorrect currency symbol in Bank Reconciliation tool --- .../bank_reconciliation_tool.js | 7 ++++--- .../bank_reconciliation_tool.json | 14 +++++++++++--- .../js/bank_reconciliation_tool/dialog_manager.js | 10 +++++----- 3 files changed, 20 insertions(+), 11 deletions(-) diff --git a/erpnext/accounts/doctype/bank_reconciliation_tool/bank_reconciliation_tool.js b/erpnext/accounts/doctype/bank_reconciliation_tool/bank_reconciliation_tool.js index ae84154f2d..22d3335ba1 100644 --- a/erpnext/accounts/doctype/bank_reconciliation_tool/bank_reconciliation_tool.js +++ b/erpnext/accounts/doctype/bank_reconciliation_tool/bank_reconciliation_tool.js @@ -72,6 +72,7 @@ frappe.ui.form.on("Bank Reconciliation Tool", { }, }) }); + }, after_save: function (frm) { @@ -89,7 +90,7 @@ frappe.ui.form.on("Bank Reconciliation Tool", { r.account, "account_currency", (r) => { - frm.currency = r.account_currency; + frm.doc.account_currency = r.account_currency; frm.trigger("render_chart"); } ); @@ -162,9 +163,9 @@ frappe.ui.form.on("Bank Reconciliation Tool", { "reconciliation_tool_cards" ).$wrapper, bank_statement_closing_balance: - frm.doc.bank_statement_closing_balance, + frm.doc.bank_statement_closing_balance, cleared_balance: frm.cleared_balance, - currency: frm.currency, + currency: frm.doc.account_currency, } ); }, diff --git a/erpnext/accounts/doctype/bank_reconciliation_tool/bank_reconciliation_tool.json b/erpnext/accounts/doctype/bank_reconciliation_tool/bank_reconciliation_tool.json index 80993d6608..93fc4439d3 100644 --- a/erpnext/accounts/doctype/bank_reconciliation_tool/bank_reconciliation_tool.json +++ b/erpnext/accounts/doctype/bank_reconciliation_tool/bank_reconciliation_tool.json @@ -14,6 +14,7 @@ "to_reference_date", "filter_by_reference_date", "column_break_2", + "account_currency", "account_opening_balance", "bank_statement_closing_balance", "section_break_1", @@ -59,7 +60,7 @@ "fieldname": "account_opening_balance", "fieldtype": "Currency", "label": "Account Opening Balance", - "options": "Currency", + "options": "account_currency", "read_only": 1 }, { @@ -67,7 +68,7 @@ "fieldname": "bank_statement_closing_balance", "fieldtype": "Currency", "label": "Closing Balance", - "options": "Currency" + "options": "account_currency" }, { "fieldname": "section_break_1", @@ -104,13 +105,20 @@ "fieldname": "filter_by_reference_date", "fieldtype": "Check", "label": "Filter by Reference Date" + }, + { + "fieldname": "account_currency", + "fieldtype": "Link", + "hidden": 1, + "label": "Account Currency", + "options": "Currency" } ], "hide_toolbar": 1, "index_web_pages_for_search": 1, "issingle": 1, "links": [], - "modified": "2023-01-13 13:00:02.022919", + "modified": "2023-03-07 11:02:24.535714", "modified_by": "Administrator", "module": "Accounts", "name": "Bank Reconciliation Tool", diff --git a/erpnext/public/js/bank_reconciliation_tool/dialog_manager.js b/erpnext/public/js/bank_reconciliation_tool/dialog_manager.js index 321b812de2..1271e38049 100644 --- a/erpnext/public/js/bank_reconciliation_tool/dialog_manager.js +++ b/erpnext/public/js/bank_reconciliation_tool/dialog_manager.js @@ -391,14 +391,14 @@ erpnext.accounts.bank_reconciliation.DialogManager = class DialogManager { fieldname: "deposit", fieldtype: "Currency", label: "Deposit", - options: "currency", + options: "account_currency", read_only: 1, }, { fieldname: "withdrawal", fieldtype: "Currency", label: "Withdrawal", - options: "currency", + options: "account_currency", read_only: 1, }, { @@ -416,18 +416,18 @@ erpnext.accounts.bank_reconciliation.DialogManager = class DialogManager { fieldname: "allocated_amount", fieldtype: "Currency", label: "Allocated Amount", - options: "Currency", + options: "account_currency", read_only: 1, }, { fieldname: "unallocated_amount", fieldtype: "Currency", label: "Unallocated Amount", - options: "Currency", + options: "account_currency", read_only: 1, }, { - fieldname: "currency", + fieldname: "account_currency", fieldtype: "Link", label: "Currency", options: "Currency", From 1eea585d29586eeee1e17853f1267231a7fcc26a Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Sun, 19 Mar 2023 14:02:53 +0530 Subject: [PATCH 02/13] refactor: allow for concurrent use of reconciliation tool 1. set default filter dates a period of one month from current date --- .../bank_reconciliation_tool.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/erpnext/accounts/doctype/bank_reconciliation_tool/bank_reconciliation_tool.js b/erpnext/accounts/doctype/bank_reconciliation_tool/bank_reconciliation_tool.js index 22d3335ba1..d977261441 100644 --- a/erpnext/accounts/doctype/bank_reconciliation_tool/bank_reconciliation_tool.js +++ b/erpnext/accounts/doctype/bank_reconciliation_tool/bank_reconciliation_tool.js @@ -18,6 +18,10 @@ frappe.ui.form.on("Bank Reconciliation Tool", { }, onload: function (frm) { + // Set default filter dates + today = frappe.datetime.get_today() + frm.doc.bank_statement_from_date = frappe.datetime.add_months(today, -1); + frm.doc.bank_statement_to_date = today; frm.trigger('bank_account'); }, @@ -32,6 +36,7 @@ frappe.ui.form.on("Bank Reconciliation Tool", { }, refresh: function (frm) { + frm.disable_save(); frappe.require("bank-reconciliation-tool.bundle.js", () => frm.trigger("make_reconciliation_tool") ); @@ -73,10 +78,11 @@ frappe.ui.form.on("Bank Reconciliation Tool", { }) }); - }, + frm.add_custom_button(__('Get Unreconciled Entries'), function() { + frm.trigger("make_reconciliation_tool"); + }); + frm.change_custom_button_type('Get Unreconciled Entries', null, 'primary'); - after_save: function (frm) { - frm.trigger("make_reconciliation_tool"); }, bank_account: function (frm) { From d791dc11a3eea4445e2e772125260923c43c3f9e Mon Sep 17 00:00:00 2001 From: Raffael Meyer <14891507+barredterra@users.noreply.github.com> Date: Sun, 19 Mar 2023 13:35:12 +0100 Subject: [PATCH 03/13] fix: patch depends on Currency Exchange Settings (#34494) --- erpnext/patches/v14_0/update_opportunity_currency_fields.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/erpnext/patches/v14_0/update_opportunity_currency_fields.py b/erpnext/patches/v14_0/update_opportunity_currency_fields.py index b803e9fa2d..af736919d8 100644 --- a/erpnext/patches/v14_0/update_opportunity_currency_fields.py +++ b/erpnext/patches/v14_0/update_opportunity_currency_fields.py @@ -7,6 +7,9 @@ from erpnext.setup.utils import get_exchange_rate def execute(): + frappe.reload_doc( + "accounts", "doctype", "currency_exchange_settings" + ) # get_exchange_rate depends on Currency Exchange Settings frappe.reload_doctype("Opportunity") opportunities = frappe.db.get_list( "Opportunity", From fc86a8568f41b95f9463d6e29c8628b2b158e67a Mon Sep 17 00:00:00 2001 From: Deepesh Garg Date: Sun, 19 Mar 2023 18:09:18 +0530 Subject: [PATCH 04/13] fix: Supplier RFQ email link (#34338) --- .../doctype/request_for_quotation/request_for_quotation.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/erpnext/buying/doctype/request_for_quotation/request_for_quotation.py b/erpnext/buying/doctype/request_for_quotation/request_for_quotation.py index 7927beb823..4590f8c3d9 100644 --- a/erpnext/buying/doctype/request_for_quotation/request_for_quotation.py +++ b/erpnext/buying/doctype/request_for_quotation/request_for_quotation.py @@ -113,7 +113,10 @@ class RequestforQuotation(BuyingController): def get_link(self): # RFQ link for supplier portal - return get_url("/app/request-for-quotation/" + self.name) + route = frappe.db.get_value( + "Portal Menu Item", {"reference_doctype": "Request for Quotation"}, ["route"] + ) + return get_url("/app/{0}/".format(route) + self.name) def update_supplier_part_no(self, supplier): self.vendor = supplier From 109a9f1390306740fa91f05ca458f5f1a968d6b8 Mon Sep 17 00:00:00 2001 From: Ankush Menat Date: Mon, 20 Mar 2023 14:46:26 +0530 Subject: [PATCH 05/13] perf: index against_sales_invoice field on DN items (#34509) This is used on Sales invoice dashboard and takes a lot of time to load as db size increases. Results: Before: ~10-20 seconds to load dashboard After: few milliseconds because of index [skip ci] --- .../stock/doctype/delivery_note_item/delivery_note_item.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/erpnext/stock/doctype/delivery_note_item/delivery_note_item.json b/erpnext/stock/doctype/delivery_note_item/delivery_note_item.json index 916ab2a05b..1763269193 100644 --- a/erpnext/stock/doctype/delivery_note_item/delivery_note_item.json +++ b/erpnext/stock/doctype/delivery_note_item/delivery_note_item.json @@ -636,7 +636,8 @@ "no_copy": 1, "options": "Sales Invoice", "print_hide": 1, - "read_only": 1 + "read_only": 1, + "search_index": 1 }, { "fieldname": "so_detail", @@ -837,7 +838,7 @@ "index_web_pages_for_search": 1, "istable": 1, "links": [], - "modified": "2022-11-09 12:17:50.850142", + "modified": "2023-03-20 14:24:10.406746", "modified_by": "Administrator", "module": "Stock", "name": "Delivery Note Item", From aaa4d1eb5582028fcf1e46de0fa1a176311e5562 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Tue, 21 Mar 2023 14:15:31 +0530 Subject: [PATCH 06/13] fix: E-commerce issue with Item Variants --- erpnext/e_commerce/variant_selector/utils.py | 24 ++++++++++++++++++- .../generators/item/item_configure.js | 22 ++++++++++++----- 2 files changed, 39 insertions(+), 7 deletions(-) diff --git a/erpnext/e_commerce/variant_selector/utils.py b/erpnext/e_commerce/variant_selector/utils.py index df62c23aa4..1a3e737928 100644 --- a/erpnext/e_commerce/variant_selector/utils.py +++ b/erpnext/e_commerce/variant_selector/utils.py @@ -1,5 +1,5 @@ import frappe -from frappe.utils import cint +from frappe.utils import cint, flt from erpnext.e_commerce.doctype.e_commerce_settings.e_commerce_settings import ( get_shopping_cart_settings, @@ -166,6 +166,27 @@ def get_next_attribute_and_values(item_code, selected_attributes): else: product_info = None + product_id = "" + website_warehouse = "" + if exact_match or filtered_items: + if exact_match and len(exact_match) == 1: + product_id = exact_match[0] + elif filtered_items_count == 1: + product_id = list(filtered_items)[0] + + if product_id: + website_warehouse = frappe.get_cached_value( + "Website Item", {"item_code": product_id}, "website_warehouse" + ) + + available_qty = 0.0 + if website_warehouse: + available_qty = flt( + frappe.db.get_value( + "Bin", {"item_code": product_id, "warehouse": website_warehouse}, "actual_qty" + ) + ) + return { "next_attribute": next_attribute, "valid_options_for_attributes": valid_options_for_attributes, @@ -173,6 +194,7 @@ def get_next_attribute_and_values(item_code, selected_attributes): "filtered_items": filtered_items if filtered_items_count < 10 else [], "exact_match": exact_match, "product_info": product_info, + "available_qty": available_qty, } diff --git a/erpnext/templates/generators/item/item_configure.js b/erpnext/templates/generators/item/item_configure.js index 231ae0587e..613c967e3d 100644 --- a/erpnext/templates/generators/item/item_configure.js +++ b/erpnext/templates/generators/item/item_configure.js @@ -186,14 +186,14 @@ class ItemConfigure { this.dialog.$status_area.empty(); } - get_html_for_item_found({ filtered_items_count, filtered_items, exact_match, product_info }) { + get_html_for_item_found({ filtered_items_count, filtered_items, exact_match, product_info, available_qty, settings }) { const one_item = exact_match.length === 1 ? exact_match[0] : filtered_items_count === 1 ? filtered_items[0] : ''; - const item_add_to_cart = one_item ? ` + let item_add_to_cart = one_item ? `