mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-01 12:38:27 +00:00
Merge pull request #45103 from frappe/mergify/bp/version-15-hotfix/pr-45006
fix: pos search by term items price (backport #45006)
This commit is contained in:
@@ -58,13 +58,17 @@ def search_by_term(search_term, warehouse, price_list):
|
|||||||
item_stock_qty = item_stock_qty // item.get("conversion_factor", 1)
|
item_stock_qty = item_stock_qty // item.get("conversion_factor", 1)
|
||||||
item.update({"actual_qty": item_stock_qty})
|
item.update({"actual_qty": item_stock_qty})
|
||||||
|
|
||||||
|
price_filters = {
|
||||||
|
"price_list": price_list,
|
||||||
|
"item_code": item_code,
|
||||||
|
}
|
||||||
|
|
||||||
|
if batch_no:
|
||||||
|
price_filters["batch_no"] = batch_no
|
||||||
|
|
||||||
price = frappe.get_list(
|
price = frappe.get_list(
|
||||||
doctype="Item Price",
|
doctype="Item Price",
|
||||||
filters={
|
filters=price_filters,
|
||||||
"price_list": price_list,
|
|
||||||
"item_code": item_code,
|
|
||||||
"batch_no": batch_no,
|
|
||||||
},
|
|
||||||
fields=["uom", "currency", "price_list_rate", "batch_no"],
|
fields=["uom", "currency", "price_list_rate", "batch_no"],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -328,13 +328,16 @@ erpnext.PointOfSale.ItemSelector = class {
|
|||||||
}
|
}
|
||||||
|
|
||||||
filter_items({ search_term = "" } = {}) {
|
filter_items({ search_term = "" } = {}) {
|
||||||
|
const selling_price_list = this.events.get_frm().doc.selling_price_list;
|
||||||
|
|
||||||
if (search_term) {
|
if (search_term) {
|
||||||
search_term = search_term.toLowerCase();
|
search_term = search_term.toLowerCase();
|
||||||
|
|
||||||
// memoize
|
// memoize
|
||||||
this.search_index = this.search_index || {};
|
this.search_index = this.search_index || {};
|
||||||
if (this.search_index[search_term]) {
|
this.search_index[selling_price_list] = this.search_index[selling_price_list] || {};
|
||||||
const items = this.search_index[search_term];
|
if (this.search_index[selling_price_list][search_term]) {
|
||||||
|
const items = this.search_index[selling_price_list][search_term];
|
||||||
this.items = items;
|
this.items = items;
|
||||||
this.render_item_list(items);
|
this.render_item_list(items);
|
||||||
this.auto_add_item && this.items.length == 1 && this.add_filtered_item_to_cart();
|
this.auto_add_item && this.items.length == 1 && this.add_filtered_item_to_cart();
|
||||||
@@ -346,7 +349,7 @@ erpnext.PointOfSale.ItemSelector = class {
|
|||||||
// eslint-disable-next-line no-unused-vars
|
// eslint-disable-next-line no-unused-vars
|
||||||
const { items, serial_no, batch_no, barcode } = message;
|
const { items, serial_no, batch_no, barcode } = message;
|
||||||
if (search_term && !barcode) {
|
if (search_term && !barcode) {
|
||||||
this.search_index[search_term] = items;
|
this.search_index[selling_price_list][search_term] = items;
|
||||||
}
|
}
|
||||||
this.items = items;
|
this.items = items;
|
||||||
this.render_item_list(items);
|
this.render_item_list(items);
|
||||||
|
|||||||
Reference in New Issue
Block a user