Merge pull request #34501 from ruthra-kumar/incorrect_currency_symbol_for_bank_accounts_in_reconciliation_tool
refactor(bank reconciliation tool): currency symbol fix and concurrent usage
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 7927beb..4590f8c 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 @@
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
diff --git a/erpnext/e_commerce/variant_selector/utils.py b/erpnext/e_commerce/variant_selector/utils.py
index df62c23..1a3e737 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 @@
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 @@
"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/patches/v14_0/update_opportunity_currency_fields.py b/erpnext/patches/v14_0/update_opportunity_currency_fields.py
index b803e9f..af73691 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 @@
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",
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 916ab2a..1763269 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",
diff --git a/erpnext/templates/generators/item/item_configure.js b/erpnext/templates/generators/item/item_configure.js
index 231ae05..613c967 100644
--- a/erpnext/templates/generators/item/item_configure.js
+++ b/erpnext/templates/generators/item/item_configure.js
@@ -186,14 +186,14 @@
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 ? `
<button data-item-code="${one_item}"
class="btn btn-primary btn-add-to-cart w-100"
data-action="btn_add_to_cart"
@@ -218,6 +218,9 @@
? '(' + product_info.price.formatted_price_sales_uom + ')'
: ''
}
+
+ ${available_qty === 0 ? '<span class="text-danger">(' + __('Out of Stock') + ')</span>' : ''}
+
</div></div>
<a href data-action="btn_clear_values" data-item-code="${one_item}">
${__('Clear Values')}
@@ -233,6 +236,10 @@
</div>`;
/* eslint-disable indent */
+ if (!product_info?.allow_items_not_in_stock && available_qty === 0) {
+ item_add_to_cart = '';
+ }
+
return `
${item_found_status}
${item_add_to_cart}
@@ -257,12 +264,15 @@
btn_clear_values() {
this.dialog.fields_list.forEach(f => {
- f.df.options = f.df.options.map(option => {
- option.disabled = false;
- return option;
- });
+ if (f.df?.options) {
+ f.df.options = f.df.options.map(option => {
+ option.disabled = false;
+ return option;
+ });
+ }
});
this.dialog.clear();
+ this.dialog.$status_area.empty();
this.on_attribute_selection();
}