diff options
| author | Nicolas Martinelli <nim@odoo.com> | 2018-09-06 14:24:49 +0200 |
|---|---|---|
| committer | Nicolas Martinelli <nim-odoo@users.noreply.github.com> | 2018-09-07 09:29:38 +0200 |
| commit | 7e83ea8d579d8eb4c89f85b8f954c637284c6b11 (patch) | |
| tree | 4d23b39111b0303f1da07c38a0e603eb38644bd0 /doc/reference/javascript_reference.rst | |
| parent | a51a5b70d3c78b65d32a9fa576dffa3d8a2af666 (diff) | |
[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
Diffstat (limited to 'doc/reference/javascript_reference.rst')
0 files changed, 0 insertions, 0 deletions
