+
${format_currency(invoice.grand_total, invoice.currency) || 0}
${posting_datetime}
diff --git a/erpnext/selling/page/point_of_sale/pos_past_order_summary.js b/erpnext/selling/page/point_of_sale/pos_past_order_summary.js
index 18d9e6aad34..c26b53e5144 100644
--- a/erpnext/selling/page/point_of_sale/pos_past_order_summary.js
+++ b/erpnext/selling/page/point_of_sale/pos_past_order_summary.js
@@ -459,6 +459,7 @@ erpnext.PointOfSale.PastOrderSummary = class {
}
toggle_component(show) {
+ this.$component.css("grid-column", "span 6 / span 6");
show ? this.$component.css("display", "flex") : this.$component.css("display", "none");
}
diff --git a/erpnext/selling/page/point_of_sale/pos_payment.js b/erpnext/selling/page/point_of_sale/pos_payment.js
index d7855803fad..b4851586557 100644
--- a/erpnext/selling/page/point_of_sale/pos_payment.js
+++ b/erpnext/selling/page/point_of_sale/pos_payment.js
@@ -61,9 +61,15 @@ erpnext.PointOfSale.Payment = class {
primary_action_label: __("Save"),
primary_action(values) {
me.set_values_to_frm(values);
+ if (this.complete_order) {
+ me.events.submit_invoice();
+ }
this.hide();
},
});
+ me.addl_dlg.$wrapper.on("hide.bs.modal", function () {
+ me.addl_dlg.complete_order = false;
+ });
me.add_btn_field_click_listener();
me.set_value_on_dialog_fields();
me.make_addl_info_dialog_btn_visible();
@@ -218,10 +224,6 @@ erpnext.PointOfSale.Payment = class {
const paid_amount = doc.paid_amount;
const items = doc.items;
- if (!this.validate_reqd_invoice_fields()) {
- return;
- }
-
if (!items.length || (paid_amount == 0 && doc.additional_discount_percentage != 100)) {
const message = items.length
? __("You cannot submit the order without payment.")
@@ -231,6 +233,10 @@ erpnext.PointOfSale.Payment = class {
return;
}
+ if (!this.validate_reqd_invoice_fields()) {
+ return;
+ }
+
this.events.submit_invoice();
});
@@ -683,16 +689,12 @@ erpnext.PointOfSale.Payment = class {
}
validate_reqd_invoice_fields() {
+ if (this.invoice_fields.length === 0) return true;
const doc = this.events.get_frm().doc;
for (const df of this.addl_dlg.fields) {
if (df.reqd && !doc[df.fieldname]) {
- frappe.show_alert({
- message: __(
- "Invoice cannot be submitted without filling the mandatory Additional Information fields."
- ),
- indicator: "red",
- });
- frappe.utils.play_sound("error");
+ this.addl_dlg.primary_action_label = "Submit";
+ this.addl_dlg.complete_order = true;
this.addl_dlg.show();
this.addl_dlg.fields_dict[df.fieldname].$input.focus();
return false;