Commit 385627f
committed
[FIX] pos_loyalty: compute point rewarded when discount reward updates
Currently loyalty points rewarded are not correctly computed when there
is a discount reward that updates its prices.
Steps to reproduce:
-------------------
* Create a loyalty program 1 point per $ spent
* Create a promo program, 10% on order, minimum 1 product on the order
* Create a product to sell in the pos, price 1$
* Open pos shop
* Select any customer
* Select the created product once
> Observation: To pay 0.9$, points remarded 0.9 OK
* Select the created product once again
> Observation: To pay 1.8$, points remarded 1.9 NOT OK
Why the fix:
------------
https://github.com/odoo/odoo/blob/b87c896969cc576a799ac63f03501be1e87b0e84/addons/pos_loyalty/static/src/overrides/models/loyalty.js#L362-L384
As the promo program giving the discoutn has already been triggered once,
it is not considered claimable again thus `changed` will never be set to
true. Thus we never call `_updateLoyaltyPrograms()`.
The recomputation of the price value for the promo discount is done by
`_updateRewardLines()`, the points need to be computed afterward .
opw-4804205
closes odoo#217925
Signed-off-by: Adrien Guilliams (adgu) <adgu@odoo.com>1 parent 3e1ac28 commit 385627f
3 files changed
Lines changed: 7 additions & 10 deletions
File tree
- addons/pos_loyalty
- static
- src/overrides/models
- tests/tours
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
363 | 363 | | |
364 | 364 | | |
365 | 365 | | |
366 | | - | |
367 | 366 | | |
368 | 367 | | |
369 | 368 | | |
| |||
372 | 371 | | |
373 | 372 | | |
374 | 373 | | |
375 | | - | |
376 | 374 | | |
377 | 375 | | |
378 | | - | |
379 | | - | |
380 | | - | |
381 | | - | |
382 | 376 | | |
| 377 | + | |
383 | 378 | | |
384 | 379 | | |
385 | 380 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
467 | 467 | | |
468 | 468 | | |
469 | 469 | | |
470 | | - | |
471 | | - | |
472 | | - | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
473 | 475 | | |
474 | 476 | | |
475 | 477 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1855 | 1855 | | |
1856 | 1856 | | |
1857 | 1857 | | |
1858 | | - | |
| 1858 | + | |
1859 | 1859 | | |
1860 | 1860 | | |
1861 | 1861 | | |
| |||
0 commit comments