[FIX] pos_loyalty: keep reward lines on a finalized order
Steps to reproduce:
- Install pos_loyalty + pos_online_payment.
- Configure an automatic discount program (e.g. 1% off the order) and an
online payment method.
- In the POS, add a customer eligible for the program and a product so
the
discount reward line is added automatically.
- Pay the order with the online payment method and let the customer pay.
Issue:
The receipt printed right after the online payment is missing the
loyalty
discount line: the total is shown without the discount while the amount
actually paid is the discounted amount, so the ticket looks underpaid.
Re-printing the order later shows the correct total. With a loyalty
program
that also gives points, confirming the order additionally raises:
ValueError: invalid literal for int() with base 10: 'false'
Cause:
After a successful online payment the order is rebuilt from the data
saved
on the server and selected again. Selecting an order triggers
`_updateRewards`, which calls `_updateRewardLines` to refresh the
applied
rewards. On this rebuilt order the reward lines reference a coupon that
is
no longer in the local cache (its `coupon_id` comes back as `false` for
"current" programs that don't persist a coupon), so `_updateRewardLines`
removes them and cannot re-apply them. The order then displays a wrong
total, and `_postPushOrderResolve` sends that `false` coupon id to
`confirm_coupon_programs`, which fails when casting the key to an int.
The order is already paid and saved: its reward lines are authoritative
and
must not be recomputed.
Fix:
- `_updateRewardLines`: do nothing on a finalized order
(paid/done/invoiced)
so the rewards saved on the server are kept as-is.
- `_postPushOrderResolve`: skip reward lines that have no coupon, so no
invalid coupon id is sent to `confirm_coupon_programs`.
| Subbuilds | Name | State | Detail |
|---|---|---|---|
| Build 385917 | At install tests: from account to website_twitter | Killed | Log |
| Build 385918 | Post install tests: step install all modules | Killed | Log |
| Build 385919 | Post install tests: from account to payment_adyen | Killed | |
| Build 385920 | Post install tests: from payment_alipay to test_viin_approval | Killed | |
| Build 385921 | Post install tests: from test_viin_mail_route to to_warranty_sale_stock | Killed | |
| Build 385922 | Post install tests: from to_warranty_stock to viin_features_activate_contacts | Killed | |
| Build 385923 | Post install tests: from viin_features_activate_freight to viin_project_scrum_helpdesk | Killed | |
| Build 385924 | Post install tests: from viin_project_timesheet_leave to website_twitter | Killed |
| Create Date | Level | Message |
|---|---|---|
| 06/16/2026 11:55:21 | INFO |
Updated repository Viindoo-tvtmaaddons
|
| 06/16/2026 11:55:21 | INFO |
Updated repository Viindoo-erponline-enterprise
|
| 06/16/2026 11:55:21 | INFO |
Updated repository Viindoo-branding
|
| 06/16/2026 11:55:21 | INFO |
Cloned repository Viindoo-odoo
|