-
- Downloads
[FIX] web: pyjs: Tokenize float numbers in scientific notation
Steps to reproduce:
- Install Dashboard, Inventory apps
- Go to Inventory > Products
- Add a custom filter "Quantity on hand > 0.00001"
- Favorites > Add to my dashboard > Add
- Go to dashboard app
Issue:
JS Traceback is raised: `Expected "]", got "(name)"`
When executing the rpc call to `/board/add_to_dashboard`, the number
`0.00001`, which is passed as argument, is decoded as `1e-05` in the
python code and stored in the custom view.
When parsing the same view in the frontend, the tokenizer fails to
detect `1e-05` as a floating number and an error is thrown while parsing.
Solution:
Add regex for floating point numbers in scientific notation in `py.js`.
The regex accepts numbers such as:
- 1.2
- 12.
- .1
- 1e-02
- 1.2E-2
- 12.e+2
- .1E3
opw-3038707
closes odoo/odoo#104828
Signed-off-by:
Samuel Degueldre <sad@odoo.com>
Showing
- addons/web/static/lib/py.js/lib/py.js 6 additions, 2 deletionsaddons/web/static/lib/py.js/lib/py.js
- addons/web/static/src/core/py_js/py_tokenizer.js 6 additions, 2 deletionsaddons/web/static/src/core/py_js/py_tokenizer.js
- addons/web/static/tests/core/py_js/py_tokenizer_tests.js 38 additions, 3 deletionsaddons/web/static/tests/core/py_js/py_tokenizer_tests.js
Loading