From 52f7760d61c075b75c1225f617c41d5df6638a3b Mon Sep 17 00:00:00 2001 From: Suherdy Yacob Date: Sun, 14 Jun 2026 11:39:10 +0700 Subject: [PATCH] feat: filter out coupons associated with archived loyalty programs in fetchCoupons --- static/src/app/pos_loyalty_safe_coupon_patch.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/static/src/app/pos_loyalty_safe_coupon_patch.js b/static/src/app/pos_loyalty_safe_coupon_patch.js index a76a487..e346569 100644 --- a/static/src/app/pos_loyalty_safe_coupon_patch.js +++ b/static/src/app/pos_loyalty_safe_coupon_patch.js @@ -155,6 +155,15 @@ patch(OrderPaymentValidation.prototype, { // ─── PosStore patches ───────────────────────────────────────────────────────── patch(PosStore.prototype, { + /** + * fetchCoupons — filter out coupons/cards of archived programs. + */ + async fetchCoupons(domain, limit = 1) { + const activeDomain = [["program_id.active", "=", true]]; + const newDomain = domain ? activeDomain.concat(domain) : activeDomain; + return await super.fetchCoupons(newDomain, limit); + }, + /** * afterProcessServerData — purge orphaned lines from ALL orders after load. */