fix(pos): specific case when serialized item not removed
This commit is contained in:
parent
2f82e237ef
commit
4afb47e869
@ -560,7 +560,7 @@ erpnext.PointOfSale.Controller = class {
|
||||
if (this.item_details.$component.is(':visible'))
|
||||
this.edit_item_details_of(item_row);
|
||||
|
||||
if (this.check_serial_batch_selection_needed(item_row))
|
||||
if (this.check_serial_batch_selection_needed(item_row) && !this.item_details.$component.is(':visible'))
|
||||
this.edit_item_details_of(item_row);
|
||||
}
|
||||
|
||||
@ -709,7 +709,7 @@ erpnext.PointOfSale.Controller = class {
|
||||
frappe.dom.freeze();
|
||||
const { doctype, name, current_item } = this.item_details;
|
||||
|
||||
frappe.model.set_value(doctype, name, 'qty', 0)
|
||||
return frappe.model.set_value(doctype, name, 'qty', 0)
|
||||
.then(() => {
|
||||
frappe.model.clear_doc(doctype, name);
|
||||
this.update_cart_html(current_item, true);
|
||||
|
@ -60,12 +60,18 @@ erpnext.PointOfSale.ItemDetails = class {
|
||||
return item && item.name == this.current_item.name;
|
||||
}
|
||||
|
||||
toggle_item_details_section(item) {
|
||||
async toggle_item_details_section(item) {
|
||||
const current_item_changed = !this.compare_with_current_item(item);
|
||||
|
||||
// if item is null or highlighted cart item is clicked twice
|
||||
const hide_item_details = !Boolean(item) || !current_item_changed;
|
||||
|
||||
if ((!hide_item_details && current_item_changed) || hide_item_details) {
|
||||
// if item details is being closed OR if item details is opened but item is changed
|
||||
// in both cases, if the current item is a serialized item, then validate and remove the item
|
||||
await this.validate_serial_batch_item();
|
||||
}
|
||||
|
||||
this.events.toggle_item_selector(!hide_item_details);
|
||||
this.toggle_component(!hide_item_details);
|
||||
|
||||
@ -83,7 +89,6 @@ erpnext.PointOfSale.ItemDetails = class {
|
||||
this.render_form(item);
|
||||
this.events.highlight_cart_item(item);
|
||||
} else {
|
||||
this.validate_serial_batch_item();
|
||||
this.current_item = {};
|
||||
}
|
||||
}
|
||||
@ -103,11 +108,11 @@ erpnext.PointOfSale.ItemDetails = class {
|
||||
(serialized && batched && (no_batch_selected || no_serial_selected))) {
|
||||
|
||||
frappe.show_alert({
|
||||
message: __("Item will be removed since no serial / batch no selected."),
|
||||
message: __("Item is removed since no serial / batch no selected."),
|
||||
indicator: 'orange'
|
||||
});
|
||||
frappe.utils.play_sound("cancel");
|
||||
this.events.remove_item_from_cart();
|
||||
return this.events.remove_item_from_cart();
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user