From d31af35746c149bea23e75ac1eb4492dc5767996 Mon Sep 17 00:00:00 2001 From: satp-odoo Date: Sat, 20 Sep 2025 22:07:35 +0530 Subject: [PATCH] [ADD] pos_customer_display: enhance pos customer display - added customer name in customer display. - display amount per guest in customer display. - added refund items subsection. Task id : 5098048 --- pos_customer_display/__manifest__.py | 18 +++++++++++ .../static/src/js/customer_display_extend.js | 31 +++++++++++++++++++ .../static/src/js/customer_display_extend.xml | 28 +++++++++++++++++ 3 files changed, 77 insertions(+) create mode 100644 pos_customer_display/__manifest__.py create mode 100644 pos_customer_display/static/src/js/customer_display_extend.js create mode 100644 pos_customer_display/static/src/js/customer_display_extend.xml diff --git a/pos_customer_display/__manifest__.py b/pos_customer_display/__manifest__.py new file mode 100644 index 00000000000..b20bd51a37e --- /dev/null +++ b/pos_customer_display/__manifest__.py @@ -0,0 +1,18 @@ +{ + "name": "POS Customer Display", + "version": "1.0", + "summary": """Improve customer's display to show customer name, amount, number of guest and segregate refund section""", + "depends": ["base", "point_of_sale"], + "category": "Point of Sale", + "assets": { + "point_of_sale.customer_display_assets": [ + "pos_customer_display/static/src/js/customer_display_extend.xml" + ], + "point_of_sale.assets_prod": [ + "pos_customer_display/static/src/js/customer_display_extend.js" + ], + }, + "installable": True, + "application": False, + "license": "LGPL-3" +} diff --git a/pos_customer_display/static/src/js/customer_display_extend.js b/pos_customer_display/static/src/js/customer_display_extend.js new file mode 100644 index 00000000000..9f2b8196687 --- /dev/null +++ b/pos_customer_display/static/src/js/customer_display_extend.js @@ -0,0 +1,31 @@ +import { patch } from "@web/core/utils/patch"; +import { PosOrder } from "@point_of_sale/app/models/pos_order"; + +patch(PosOrder.prototype, { + getCustomerDisplayData() { + const orderlines = this.getSortedOrderlines(); + + const activeItems = []; + const refundedItems = []; + for (const line of orderlines) { + if (line.refunded_orderline_id) { + refundedItems.push(line.getDisplayData()); + } else { + activeItems.push(line.getDisplayData()); + } + } + + const guests = Math.max(this.guest_count || 0, 0); + const totalWithTax = this.get_total_with_tax(); + const amountPerGuest = guests > 0 ? totalWithTax / guests : null; + + return { + ...super.getCustomerDisplayData(), + + customerName: this.get_partner_name() || "Guest", + amountPerGuest, + activeItems, + refundedItems, + }; + }, +}); diff --git a/pos_customer_display/static/src/js/customer_display_extend.xml b/pos_customer_display/static/src/js/customer_display_extend.xml new file mode 100644 index 00000000000..391914c96d8 --- /dev/null +++ b/pos_customer_display/static/src/js/customer_display_extend.xml @@ -0,0 +1,28 @@ + + + + +
+
+
Customer
+
+
+ +
+
Amount
+
/ Guest +
+ +
+ + + + + + +
Refunded Items
+ +
+
+
+