Go to file
2026-05-29 17:14:56 +07:00
static/src/app refactor: move _code_activated_coupon_ids property definition from PosStore to PosOrder for better state management 2026-05-29 17:14:56 +07:00
__init__.py first commit 2026-05-21 11:08:20 +07:00
__manifest__.py chore: update module author and add .gitignore file 2026-05-21 15:25:36 +07:00
.gitignore chore: update module author and add .gitignore file 2026-05-21 15:25:36 +07:00
README.md fix: handle missing program_id in POS reward lines and update module documentation 2026-05-28 08:31:22 +07:00

POS Loyalty Safe Coupon Patch

This custom Odoo module resolves critical Point of Sale (POS) Loyalty bugs in Odoo 19 that cause the POS UI to crash or render as a blank screen.

Unsafe Coupon Access Fix

When an order is restored (e.g., during table switching in a restaurant) and references a coupon that is not yet fully loaded in the local client registry, Odoo leaves coupon_id as undefined. Accessing .id on this undefined object crashes the POS UI.

How it works:

  • Dynamically patches PosOrder.getLoyaltyPoints(), OrderPaymentValidation.validateOrder(), and PosStore.postProcessLoyalty().
  • Temporarily mocks any missing coupon_id references with { id: 0 }.
  • Intercepts this.data.call during postProcessLoyalty to strip out dummy coupon records with ID 0 before communicating with the backend.

Invalid/Archived Rewards & program_id Fix

During startup or draft order restoration, if an existing order contains a reward line whose corresponding reward_id or reward_id.program_id is missing or archived (and therefore not loaded in the client registry), Odoo attempts to read program_type from it. This triggers a TypeError: Cannot read properties of undefined (reading 'program_id') or (reading 'program_type') and leaves a blank screen.

How it works:

  • Dynamically patches PosOrder._updateRewardLines() and PosStore.orderUpdateLoyaltyPrograms().
  • Automatically filters and deletes reward lines that are missing a valid reward_id or its associated program_id.
  • Restores non-corrupted order lines, safely healing the order state and allowing the POS session to load successfully.

This ensures zero side effects, maximum stability, and clean compatibility with standard/custom addons.