From 5e196ab48a59bde39ea624be4805a7983b33106e Mon Sep 17 00:00:00 2001 From: Suherdy Yacob Date: Tue, 2 Jun 2026 15:28:33 +0700 Subject: [PATCH] feat: add patches to handle JSON parsing for order and orderline internal notes in KDS --- __manifest__.py | 7 ++++++- static/src/app/components/order/order_patch.js | 14 ++++++++++++++ .../app/components/orderline/orderline_patch.js | 14 ++++++++++++++ 3 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 static/src/app/components/order/order_patch.js create mode 100644 static/src/app/components/orderline/orderline_patch.js diff --git a/__manifest__.py b/__manifest__.py index 116e2c5..8986d5c 100644 --- a/__manifest__.py +++ b/__manifest__.py @@ -17,7 +17,12 @@ and todo status of previously processed prep order lines. 'version': '19.0.1.0.0', 'depends': ['pos_enterprise'], 'data': [], - 'assets': {}, + 'assets': { + 'pos_preparation_display.assets': [ + 'pos_kds_fix/static/src/app/components/orderline/orderline_patch.js', + 'pos_kds_fix/static/src/app/components/order/order_patch.js', + ], + }, 'installable': True, 'auto_install': False, } diff --git a/static/src/app/components/order/order_patch.js b/static/src/app/components/order/order_patch.js new file mode 100644 index 0000000..ccceb83 --- /dev/null +++ b/static/src/app/components/order/order_patch.js @@ -0,0 +1,14 @@ +/** @odoo-module **/ + +import { Order } from "@pos_enterprise/app/components/order/order"; +import { patch } from "@web/core/utils/patch"; + +patch(Order.prototype, { + get pdisNotes() { + try { + return JSON.parse(this.order.pos_order_id.internal_note || "[]"); + } catch (e) { + return [{ text: this.order.pos_order_id.internal_note, colorIndex: 0 }]; + } + } +}); diff --git a/static/src/app/components/orderline/orderline_patch.js b/static/src/app/components/orderline/orderline_patch.js new file mode 100644 index 0000000..9a77314 --- /dev/null +++ b/static/src/app/components/orderline/orderline_patch.js @@ -0,0 +1,14 @@ +/** @odoo-module **/ + +import { Orderline } from "@pos_enterprise/app/components/orderline/orderline"; +import { patch } from "@web/core/utils/patch"; + +patch(Orderline.prototype, { + get internalNotes() { + try { + return JSON.parse(this.preparation_line.internal_note || "[]"); + } catch (e) { + return [{ text: this.preparation_line.internal_note, colorIndex: 0 }]; + } + } +});