mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-04 12:49:10 +00:00
refactor: print receipt on order complete on pos (#46501)
This commit is contained in:
@@ -449,6 +449,7 @@ erpnext.PointOfSale.Controller = class {
|
|||||||
init_order_summary() {
|
init_order_summary() {
|
||||||
this.order_summary = new erpnext.PointOfSale.PastOrderSummary({
|
this.order_summary = new erpnext.PointOfSale.PastOrderSummary({
|
||||||
wrapper: this.$components_wrapper,
|
wrapper: this.$components_wrapper,
|
||||||
|
settings: this.settings,
|
||||||
events: {
|
events: {
|
||||||
get_frm: () => this.frm,
|
get_frm: () => this.frm,
|
||||||
|
|
||||||
@@ -489,7 +490,6 @@ erpnext.PointOfSale.Controller = class {
|
|||||||
]);
|
]);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
pos_profile: this.pos_profile,
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
erpnext.PointOfSale.PastOrderSummary = class {
|
erpnext.PointOfSale.PastOrderSummary = class {
|
||||||
constructor({ wrapper, events, pos_profile }) {
|
constructor({ wrapper, settings, events }) {
|
||||||
this.wrapper = wrapper;
|
this.wrapper = wrapper;
|
||||||
this.events = events;
|
this.events = events;
|
||||||
this.pos_profile = pos_profile;
|
this.print_receipt_on_order_complete = settings.print_receipt_on_order_complete;
|
||||||
|
|
||||||
this.init_component();
|
this.init_component();
|
||||||
}
|
}
|
||||||
@@ -391,8 +391,8 @@ erpnext.PointOfSale.PastOrderSummary = class {
|
|||||||
|
|
||||||
this.add_summary_btns(condition_btns_map);
|
this.add_summary_btns(condition_btns_map);
|
||||||
|
|
||||||
if (after_submission) {
|
if (after_submission && this.print_receipt_on_order_complete) {
|
||||||
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");
|
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) {
|
async is_pos_invoice_returnable(invoice) {
|
||||||
const r = await frappe.call({
|
const r = await frappe.call({
|
||||||
method: "erpnext.controllers.sales_and_purchase_return.is_pos_invoice_returnable",
|
method: "erpnext.controllers.sales_and_purchase_return.is_pos_invoice_returnable",
|
||||||
|
|||||||
Reference in New Issue
Block a user