Discount types
Presets are configured in the Odoo backend (nu.pos.discount.preset):
Each preset has an
applies_to field: item, check, or both.
Comp
A comp is a 100% discount applied directly (no modal). Triggered from the “Comp Item” tile in the item detail panel. If the user’smax_discount is below 100, a manager override is required.
Access control
1
Permission check
User clicks discount/comp. System checks
canPerformAction(role, "discount", permissions).2
Allowed
Proceed to
DiscountModal (or apply comp directly for 100% discount).3
Denied
Open
ManagerOverrideModal for PIN approval by an authorized manager.Max discount enforcement
Each user has amax_discount value from their PosUser record:
0= unlimited (no cap)> 0= maximum percentage this user can apply
DiscountModal clamps input to maxDiscount. When a manager approves via override, their own max_discount is used. In the override modal, managers with insufficient max_discount are shown grayed out.
Data flow
Item discount
Check discount
Stacking
Item and check discounts compose multiplicatively: 10% item + 20% check = 28% total, not 30%.Reducer actions
Audit trail
BothItemDiscountState and CheckDiscountState store:
appliedByUserId/appliedByName— who applied the discountapprovedByUserId/approvedByName— manager who approved (if override was needed)presetId/presetName— which preset was used (if any)
Hub sync
discountState and checkDiscount flow through the snapshot pipeline:
buildSnapshot()includes them on items and ordersrebuildOrderFromSnapshot()restores them
Backend addon
nu_pos_discounts/ — Odoo 12 addon. Extends _get_bootstrap_extra() to include discount_presets array:
i18n
Translations in thediscounts namespace (src/i18n/locales/{en,es}.json).
Testing
models.test.ts— Parsing, preset filteringservices.test.ts—computeDiscountPct,distributeCheckDiscount,composeDiscountPct