How to reproduce:
- Install website_slides with demo data
- Connect as admin
- Go to the front-end and click on "Courses"
The karma wheel shows 100%, "master" and a karma of 2.5k xp while it should be:
4% on the wheel, "Doctor", 2.5 / 10k (karma_min for master is at 20k and next
level is doctor at 10k).
We solve that issue by fixing the method that determine the next rank (see
technical note for more details).
Technical note: the problem occurs because the admin user has the rank 4 but
its field next_rank_id is null while there is a level 5. In that condition, the
method _get_next_rank returns an empty recordset while it should return the
rank 5. We simplify that method to always return a rank if there is one
suitable (if you reach the last level, there are no next level).
Task-3617054
X-original-commit: 6639005e660d0516a7624bd274c27e897797d614
Part-of: odoo/odoo#157655