Skip to content

feat: pos configuration for print receipt on complete order #45024

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 15 additions & 8 deletions erpnext/accounts/doctype/pos_profile/pos_profile.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"hide_unavailable_items",
"auto_add_item_to_cart",
"validate_stock_on_save",
"print_receipt_on_order_complete",
"column_break_16",
"update_stock",
"ignore_pricing_rule",
Expand Down Expand Up @@ -374,24 +375,30 @@
},
{
"fieldname": "utm_campaign",
"print_hide": 1,
"fieldtype": "Link",
"label": "Campaign",
"options": "UTM Campaign"
"options": "UTM Campaign",
"print_hide": 1
},
{
"fieldname": "utm_source",
"print_hide": 1,
"fieldtype": "Link",
"label": "Source",
"options": "UTM Source"
"options": "UTM Source",
"print_hide": 1
},
{
"fieldname": "utm_medium",
"print_hide": 1,
"fieldtype": "Link",
"label": "Medium",
"options": "UTM Campaign"
"options": "UTM Campaign",
"print_hide": 1
},
{
"default": "0",
"fieldname": "print_receipt_on_order_complete",
"fieldtype": "Check",
"label": "Print Receipt on Order Complete"
}
],
"icon": "icon-cog",
Expand Down Expand Up @@ -419,7 +426,7 @@
"link_fieldname": "pos_profile"
}
],
"modified": "2024-06-28 10:51:48.543766",
"modified": "2025-01-01 11:07:03.161950",
"modified_by": "Administrator",
"module": "Accounts",
"name": "POS Profile",
Expand Down Expand Up @@ -448,4 +455,4 @@
"sort_field": "creation",
"sort_order": "DESC",
"states": []
}
}
1 change: 1 addition & 0 deletions erpnext/accounts/doctype/pos_profile/pos_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ class POSProfile(Document):
letter_head: DF.Link | None
payments: DF.Table[POSPaymentMethod]
print_format: DF.Link | None
print_receipt_on_order_complete: DF.Check
select_print_heading: DF.Link | None
selling_price_list: DF.Link | None
tax_category: DF.Link | None
Expand Down
17 changes: 16 additions & 1 deletion erpnext/selling/page/point_of_sale/pos_past_order_summary.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
erpnext.PointOfSale.PastOrderSummary = class {
constructor({ wrapper, events }) {
constructor({ wrapper, events, pos_profile }) {
this.wrapper = wrapper;
this.events = events;
this.pos_profile = pos_profile;

this.init_component();
}
Expand Down Expand Up @@ -355,6 +356,8 @@ erpnext.PointOfSale.PastOrderSummary = class {
const condition_btns_map = this.get_condition_btn_map(after_submission);

this.add_summary_btns(condition_btns_map);

this.print_receipt_on_order_complete();
}

attach_document_info(doc) {
Expand Down Expand Up @@ -421,4 +424,16 @@ 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();
}
}
};
Loading