v 8.0 v 9.0 v 10.0 v 12.0 Third Party 917
Download for v 9.0
Availability
Odoo Online
Odoo.sh
On Premise
Technical Name web_widget_float_formula
LicenseAGPL-3
Websitehttp://www.grap.coop
Versions 9.0 10.0 12.0 8.0
You bought this module and need support? Click here!

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.

Please log in to comment on this module

  • The author can leave a single reply to each comment.
  • This section is meant to ask simple questions or leave a rating. Every report of a problem experienced while using the module should be addressed to the author directly (refer to the following point).
  • If you want to start a discussion with the author, please use the developer contact information. They can usually be found in the description.
Please choose a rating from 1 to 5 for this module.