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

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

(cherry picked from commit 0552209310)

# Conflicts:
#	erpnext/selling/page/point_of_sale/pos_past_order_summary.js

* chore: resolve conflict

---------

Co-authored-by: Diptanil Saha <diptanil@frappe.io>
This commit is contained in:
mergify[bot]
2025-03-13 14:30:38 +05:30
committed by GitHub
parent 32335da839
commit 2a788a4fb1
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,
@@ -485,7 +486,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();
}
@@ -357,8 +357,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();
}
}
@@ -426,16 +426,4 @@ erpnext.PointOfSale.PastOrderSummary = class {
toggle_component(show) {
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();
}
}
};