refactor: print receipt on order complete on pos (#46501)

This commit is contained in:
Diptanil Saha
2025-03-13 14:22:05 +05:30
committed by GitHub
parent 378a554ea2
commit 0552209310
2 changed files with 5 additions and 17 deletions

View File

@@ -449,6 +449,7 @@ erpnext.PointOfSale.Controller = class {
init_order_summary() {
this.order_summary = new erpnext.PointOfSale.PastOrderSummary({
wrapper: this.$components_wrapper,
settings: this.settings,
events: {
get_frm: () => this.frm,
@@ -489,7 +490,6 @@ erpnext.PointOfSale.Controller = class {
]);
},
},
pos_profile: this.pos_profile,
});
}

View File

@@ -1,8 +1,8 @@
erpnext.PointOfSale.PastOrderSummary = class {
constructor({ wrapper, events, pos_profile }) {
constructor({ wrapper, settings, events }) {
this.wrapper = wrapper;
this.events = events;
this.pos_profile = pos_profile;
this.print_receipt_on_order_complete = settings.print_receipt_on_order_complete;
this.init_component();
}
@@ -391,8 +391,8 @@ erpnext.PointOfSale.PastOrderSummary = class {
this.add_summary_btns(condition_btns_map);
if (after_submission) {
this.print_receipt_on_order_complete();
if (after_submission && this.print_receipt_on_order_complete) {
this.print_receipt();
}
}
@@ -461,18 +461,6 @@ erpnext.PointOfSale.PastOrderSummary = class {
show ? this.$component.css("display", "flex") : this.$component.css("display", "none");
}
async print_receipt_on_order_complete() {
const res = await frappe.db.get_value(
"POS Profile",
this.pos_profile,
"print_receipt_on_order_complete"
);
if (res.message.print_receipt_on_order_complete) {
this.print_receipt();
}
}
async is_pos_invoice_returnable(invoice) {
const r = await frappe.call({
method: "erpnext.controllers.sales_and_purchase_return.is_pos_invoice_returnable",