Files
odoo_source/addons
Nicolas Martinelli 7e83ea8d57 [FIX] point_of_sale: restrict price control
- Activate the Price Control option in the POS
- Connect as Admin => you are allowed to modify the price
- Switch the user to Demo => you are still allowed to modify the price
- Switch back to Admin => you are not allowed to modify the prices

The two last steps are clearly incorrect.

The reason is the following.
The function `applyAccessRights` is bound to `'change:cashier'` event of
the `pos` at:

https://github.com/odoo/odoo/blob/d25719cdf2b8a863c1a855f2e42e9c3a43580f66/addons/point_of_sale/static/src/js/screens.js#L389

When switching the user, 2 steps are performed:
1. Set the cashier on the `pos`
2. Set the cashier on the `pos.db`

https://github.com/odoo/odoo/blob/d25719cdf2b8a863c1a855f2e42e9c3a43580f66/addons/point_of_sale/static/src/js/models.js#L646-L647

Step 1 will trigger the function `applyAccessRights`, which calls
`pos.get_cashier`. However, the latter retrieves the user on `pos.db`
first, and falls back on `pos`.

https://github.com/odoo/odoo/blob/d25719cdf2b8a863c1a855f2e42e9c3a43580f66/addons/point_of_sale/static/src/js/models.js#L642

This means that we retrieve the cashier in the `pos.db` before it is
actually set (in step 2).

To avoid this, we explicitly retrieve the cashier on the `pos`, then
fall back on the usual `pos.get_cashier` function.

Closes #26814
opw-1871189
opw-1881172
2018-09-07 09:29:38 +02:00
..
2018-07-24 10:45:46 +02:00
2018-07-24 10:45:46 +02:00
2018-07-24 10:45:46 +02:00
2018-07-24 10:45:46 +02:00
2018-07-24 10:45:46 +02:00
2018-07-24 10:45:46 +02:00
2018-07-24 17:43:33 +02:00
2018-07-24 10:45:46 +02:00
2018-07-24 10:45:46 +02:00
2018-07-24 10:45:46 +02:00
2018-07-24 10:45:46 +02:00
2018-07-24 10:45:46 +02:00
2018-09-03 12:05:30 +02:00
2018-09-03 11:57:49 +02:00