Merge pull request #11470 from rohitwaghchaure/pos_online_invalid_grand_total_issue
[Fix] Fast clicking on an item, showing invalid grand total and quantity in the POS cart
This commit is contained in:
commit
6058dcc2ce
@ -43,6 +43,7 @@ erpnext.pos.PointOfSale = class PointOfSale {
|
|||||||
|
|
||||||
make() {
|
make() {
|
||||||
return frappe.run_serially([
|
return frappe.run_serially([
|
||||||
|
() => frappe.dom.freeze(),
|
||||||
() => {
|
() => {
|
||||||
this.prepare_dom();
|
this.prepare_dom();
|
||||||
this.prepare_menu();
|
this.prepare_menu();
|
||||||
@ -55,6 +56,7 @@ erpnext.pos.PointOfSale = class PointOfSale {
|
|||||||
frappe.timeout(1);
|
frappe.timeout(1);
|
||||||
this.make_items();
|
this.make_items();
|
||||||
this.bind_events();
|
this.bind_events();
|
||||||
|
frappe.dom.unfreeze();
|
||||||
},
|
},
|
||||||
() => this.page.set_title(__('Point of Sale'))
|
() => this.page.set_title(__('Point of Sale'))
|
||||||
]);
|
]);
|
||||||
@ -156,6 +158,7 @@ erpnext.pos.PointOfSale = class PointOfSale {
|
|||||||
}
|
}
|
||||||
|
|
||||||
update_item_in_cart(item_code, field='qty', value=1) {
|
update_item_in_cart(item_code, field='qty', value=1) {
|
||||||
|
frappe.dom.freeze();
|
||||||
if(this.cart.exists(item_code)) {
|
if(this.cart.exists(item_code)) {
|
||||||
const item = this.frm.doc.items.find(i => i.item_code === item_code);
|
const item = this.frm.doc.items.find(i => i.item_code === item_code);
|
||||||
frappe.flags.hide_serial_batch_dialog = false;
|
frappe.flags.hide_serial_batch_dialog = false;
|
||||||
@ -220,6 +223,7 @@ erpnext.pos.PointOfSale = class PointOfSale {
|
|||||||
this.cart.add_item(item);
|
this.cart.add_item(item);
|
||||||
this.cart.update_taxes_and_totals();
|
this.cart.update_taxes_and_totals();
|
||||||
this.cart.update_grand_total();
|
this.cart.update_grand_total();
|
||||||
|
frappe.dom.unfreeze();
|
||||||
}
|
}
|
||||||
|
|
||||||
update_item_in_frm(item, field, value) {
|
update_item_in_frm(item, field, value) {
|
||||||
@ -232,8 +236,6 @@ erpnext.pos.PointOfSale = class PointOfSale {
|
|||||||
return frappe.model.set_value(item.doctype, item.name, field, value)
|
return frappe.model.set_value(item.doctype, item.name, field, value)
|
||||||
.then(() => this.frm.script_manager.trigger('qty', item.doctype, item.name))
|
.then(() => this.frm.script_manager.trigger('qty', item.doctype, item.name))
|
||||||
.then(() => {
|
.then(() => {
|
||||||
console.log(item.qty, item.amount);
|
|
||||||
|
|
||||||
if (field === 'qty' && item.qty === 0) {
|
if (field === 'qty' && item.qty === 0) {
|
||||||
frappe.model.clear_doc(item.doctype, item.name);
|
frappe.model.clear_doc(item.doctype, item.name);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user