Allow use of simple formulas in float fields
Project description
Formulas in Float Fields
This module allows the use of simple math formulas in integer/float fields (e.g. “=45 + 4/3 - 5 * (2 + 1)”).
Only supports parentheses, decimal points, thousands separators, and the operators “+”, “-”, “*”, and “/”
Will use the decimal point and thousands separator characters associated with your language
If the formula is valid, the result will be computed and displayed, and the formula will be stored for editing
If the formula is not valid, it’s retained in the field as text
Technical Details
Overloads web.form_widgets.FieldFloat (so it works for fields.integer & fields.float)
Uses the eval() JS function to evaluate the formula
Does not do any rounding (this is handled elsewhere)
Avoids code injection by applying strict regex to formula prior to eval() (e.g. “=alert(‘security’)” would not get evaluated)
Installation
To install this module, simply follow the standard install process.
Configuration
No configuration is needed or possible.
Usage
Install and enjoy. A short demo video can be found at http://www.youtube.com/watch?v=jQGdD34WYrA.
Known Issues / Roadmap
Bug Tracker
Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us smash it by providing detailed and welcomed feedback.
Credits
Contributors
Sylvain Le Gal (https://twitter.com/legalsylvain)
Oleg Bulkin <o.bulkin@gmail.com>
Maintainer
This module is maintained by the OCA.
OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.
To contribute to this module, please visit http://odoo-community.org.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
File details
Details for the file odoo10_addon_web_widget_float_formula-10.0.1.0.0-py2-none-any.whl
.
File metadata
- Download URL: odoo10_addon_web_widget_float_formula-10.0.1.0.0-py2-none-any.whl
- Upload date:
- Size: 15.6 kB
- Tags: Python 2
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a039a088869bd3efd8f5303fd31707a224f5c955b34316b1b6e24dad6261e807 |
|
MD5 | c570bfe9e19fe69ec5de45cd26eb9dc6 |
|
BLAKE2b-256 | fc0e702e79c5fe8b2edf166a29b588e2e438fcda138425b58dbc6fea0a69747e |