diff --git a/__manifest__.py b/__manifest__.py index 00146cf..a6d69d3 100644 --- a/__manifest__.py +++ b/__manifest__.py @@ -23,7 +23,6 @@ Custom POS Loyalty and Membership management features: ], 'assets': { 'point_of_sale._assets_pos': [ - 'pos_loyalty_member_custom/static/src/app/screens/partner_list_patch.xml', 'pos_loyalty_member_custom/static/src/app/screens/partner_list_patch.js', 'pos_loyalty_member_custom/static/src/app/models/pos_order_patch.js', ] diff --git a/static/src/app/screens/partner_list_patch.js b/static/src/app/screens/partner_list_patch.js index 60044be..ba7ea9c 100644 --- a/static/src/app/screens/partner_list_patch.js +++ b/static/src/app/screens/partner_list_patch.js @@ -7,24 +7,46 @@ import { normalize } from "@web/core/l10n/utils"; patch(PartnerList.prototype, { setup() { super.setup(...arguments); - this.state.inputQuery = ""; + const realState = this.state; + this.realState = realState; + this.inputQuery = ""; + + this.state = new Proxy(realState, { + get: (target, prop, receiver) => { + if (prop === "query") { + // Access target.query to register dependency for reactivity when needed + const _unused = target.query; + return this.inputQuery; + } + return Reflect.get(target, prop, receiver); + }, + set: (target, prop, value, receiver) => { + if (prop === "query") { + this.inputQuery = value; + if (!value && target.query !== "") { + target.query = ""; + } + return true; + } + return Reflect.set(target, prop, value, receiver); + } + }); + this._filteredLoyaltyCache = new Map(); this._partnersSearchCache = new Map(); }, - onInputQueryChange(newValue) { - if (!newValue) { - this.state.query = ""; - } - }, - async searchPartner() { - this.state.query = this.state.inputQuery || ""; + if (this.realState) { + this.realState.query = this.inputQuery || ""; + } return super.searchPartner(...arguments); }, async onEnter() { - this.state.query = this.state.inputQuery || ""; + if (this.realState) { + this.realState.query = this.inputQuery || ""; + } return super.onEnter(...arguments); },