fix: POS items not loading
This commit is contained in:
parent
1296599857
commit
b00c16470d
@ -251,7 +251,15 @@ erpnext.pos.PointOfSale = class PointOfSale {
|
|||||||
frappe.flags.hide_serial_batch_dialog = true;
|
frappe.flags.hide_serial_batch_dialog = true;
|
||||||
|
|
||||||
frappe.run_serially([
|
frappe.run_serially([
|
||||||
() => this.frm.script_manager.trigger('item_code', item.doctype, item.name),
|
() => {
|
||||||
|
this.frm.script_manager.trigger('item_code', item.doctype, item.name)
|
||||||
|
.then(() => {
|
||||||
|
this.frm.script_manager.trigger('qty', item.doctype, item.name)
|
||||||
|
.then(() => {
|
||||||
|
this.update_cart_data(item);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
() => {
|
() => {
|
||||||
const show_dialog = item.has_serial_no || item.has_batch_no;
|
const show_dialog = item.has_serial_no || item.has_batch_no;
|
||||||
|
|
||||||
@ -261,9 +269,6 @@ erpnext.pos.PointOfSale = class PointOfSale {
|
|||||||
(item.has_serial_no) || (item.actual_batch_qty != item.actual_qty)) ) {
|
(item.has_serial_no) || (item.actual_batch_qty != item.actual_qty)) ) {
|
||||||
// check has serial no/batch no and update cart
|
// check has serial no/batch no and update cart
|
||||||
this.select_batch_and_serial_no(item);
|
this.select_batch_and_serial_no(item);
|
||||||
} else {
|
|
||||||
// update cart
|
|
||||||
this.update_cart_data(item);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
|
@ -29,7 +29,7 @@ def get_items(start, page_length, price_list, item_group, search_value="", pos_p
|
|||||||
batch_no = data.get("batch_no") if data.get("batch_no") else ""
|
batch_no = data.get("batch_no") if data.get("batch_no") else ""
|
||||||
barcode = data.get("barcode") if data.get("barcode") else ""
|
barcode = data.get("barcode") if data.get("barcode") else ""
|
||||||
|
|
||||||
item_code, condition = get_conditions(item_code, serial_no, batch_no, barcode)
|
condition = get_conditions(item_code, serial_no, batch_no, barcode)
|
||||||
|
|
||||||
if pos_profile:
|
if pos_profile:
|
||||||
condition += get_item_group_condition(pos_profile)
|
condition += get_item_group_condition(pos_profile)
|
||||||
@ -86,7 +86,6 @@ def get_items(start, page_length, price_list, item_group, search_value="", pos_p
|
|||||||
and {condition} limit {start}, {page_length}""".format
|
and {condition} limit {start}, {page_length}""".format
|
||||||
(start=start,page_length=page_length,lft=lft, rgt=rgt, condition=condition),
|
(start=start,page_length=page_length,lft=lft, rgt=rgt, condition=condition),
|
||||||
{
|
{
|
||||||
'item_code': item_code,
|
|
||||||
'price_list': price_list,
|
'price_list': price_list,
|
||||||
'warehouse': warehouse
|
'warehouse': warehouse
|
||||||
} , as_dict=1)
|
} , as_dict=1)
|
||||||
@ -133,12 +132,10 @@ def search_serial_or_batch_or_barcode_number(search_value):
|
|||||||
|
|
||||||
def get_conditions(item_code, serial_no, batch_no, barcode):
|
def get_conditions(item_code, serial_no, batch_no, barcode):
|
||||||
if serial_no or batch_no or barcode:
|
if serial_no or batch_no or barcode:
|
||||||
return frappe.db.escape(item_code), "i.name = %(item_code)s"
|
return "i.name = {0}".format(frappe.db.escape(item_code))
|
||||||
|
|
||||||
condition = """(i.name like %(item_code)s
|
return """(i.name like {item_code}
|
||||||
or i.item_name like %(item_code)s)"""
|
or i.item_name like {item_code})""".format(item_code = frappe.db.escape('%' + item_code + '%'))
|
||||||
|
|
||||||
return frappe.db.escape('%' + item_code + '%'), condition
|
|
||||||
|
|
||||||
def get_item_group_condition(pos_profile):
|
def get_item_group_condition(pos_profile):
|
||||||
cond = "and 1=1"
|
cond = "and 1=1"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user