Skip to main content
License: AGPL-3

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.

Try me on Runbot

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

Maintainer

Odoo Community Association

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.

Release files for odoo9-addon-web-widget-float-formula 9.0.1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for odoo9-addon-web-widget-float-formula 9.0.1.0.0
File Interpreter ABI Platform
odoo9_addon_web_widget_float_formula-9.0.1.0.0-py2-none-any.whl Python 2 none any Details

Release files / odoo9_addon_web_widget_float_formula-9.0.1.0.0-py2-none-any.whl

Download URL odoo9_addon_web_widget_float_formula-9.0.1.0.0-py2-none-any.whl
Size 15.3 kB
Tags Python 2
SHA-256 checksum
How to use checksums
a94dc0346fc5c815052bda064e071fc3cbb25ab308c3e3ae806bb617aa038c5b
BLAKE2b-256 checksum
How to use checksums
c0d01678200a1ae9db8da4dd5b4c63bdbe3c66c3331cdbc56ab7a15432940d39
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page