Skip to main content
iVentureTeam

float_factor

The float_factor widget shows a stored float multiplied by a constant, and divides the user's input back down when saving. It is how you display a ratio as a percentage without changing what the database holds.

September 18, 2026Updated September 18, 20263 min read
Technical namefloat_factor
Field typesfloat
Viewsform, list
Moduleweb, present in every Odoo database
Used in core0 uses in Odoo 19 Community or Enterprise. It exists for custom views and third-party modules.
VersionsOdoo 19.0, Odoo 20.0
No-code setupNo. There is no Studio entry for this widget.
Alternativespercentage, float, float_toggle, float_time

What the float_factor widget does

float_factor is a thin subclass of the standard float widget. It overrides exactly two things: the getter that produces the displayed value, and the parser that reads the user's input back.

parse(value) {
    return super.parse(value) / this.props.factor;
}

get value() {
    return this.props.record.data[this.props.name] * this.props.factor;
}

That is the entire widget. Display multiplies, save divides, and the two cancel out so the stored value keeps whatever unit the model intended.

Because the descriptor spreads the float descriptor, it inherits every option the float widget supports and adds factor to the list.

What this means for your team

This solves one specific annoyance: the database stores a ratio and people want to read a percentage. A margin stored as 0.35 reads badly on a form. With factor set to 100 it reads as 35, and when someone types 40 the database receives 0.4.

Nobody has to remember to divide. No computed field, no second column, no reporting drift between what the form shows and what the database holds.

The caution is unit confusion. The form now says 35 and the export says 0.35. If your team exports to spreadsheets, tell them once, or they will find it themselves at the worst moment.

Supported options in Odoo 19

factor is the widget's own option. Everything the standard float widget supports also applies here, because the descriptor spreads it. The one you will reach for most is digits, which controls the displayed precision.

OptionTypeWhat it does
factornumberThe multiplier applied to the stored value for display, and divided back out when the user saves. A factor of 100 shows a stored 0.35 as 35. Leaving it out gives you a plain float field, because the component's default props set it to 1.(default: 1)

Watch the interaction between factor and digits. Rounding is applied to the scaled display value, not to the stored one. A stored 0.33333 with factor 100 and two digits shows 33.33, but the database still holds the long value. If a user does not retype the field, that precision survives, and a later export will not match what they saw.

Working examples

A ratio stored as a decimal, shown as a percentage:

<field name="margin" widget="float_factor"
       options="{'factor': 100, 'digits': [16, 2]}"/>

Hours stored as a fraction of a day, shown as hours:

<field name="day_fraction" widget="float_factor"
       options="{'factor': 24}"/>

Omitting factor is legal and does nothing useful, because the default is 1:

<!-- identical to a plain float field -->
<field name="ratio" widget="float_factor"/>

Version compatibility

VersionStatusNotes
Odoo 19.0VerifiedVerified against the shipped 19.0 source.
Odoo 20.0VerifiedVerified against the 20.0 branch. No changes.

Stable across both branches we checked.

What is changing in Odoo 20

No change. We diffed the float_factor registration between the 19.0 and 20.0 branches: no options added, none removed, same supported types and same component shape.

Note that its sibling float_toggle did change in Odoo 20, gaining a hide_trailing_zeros option. float_factor did not gain it.

Common problems and fixes

SymptomCause and fix
The widget shows the raw stored number, unscaledfactor was not passed, so it defaulted to 1. Add options="{'factor': 100}" or whatever multiplier you need.
Exports and reports disagree with the formWorking as designed. The widget scales the display only; the stored value is unchanged and that is what reports read. Add a stored computed field holding the scaled value if reports need it, or scale in the report itself.
A value looks rounded on screen but comes back long in an exportdigits rounds the displayed value, not the stored one. Round server-side in the field definition if the stored precision matters.

Float_factor widget vs the alternatives

WidgetBest forKey difference
float_factorShowing a stored float in a different unitMultiplies for display and divides on save, leaving the database untouched
percentageA ratio shown as a percentage with the signFixed to percent, and renders the symbol for you
floatA plain float with no scalingShows the stored value as is
float_toggleCycling a float between a few fixed values on clickAlso takes a factor, but the user clicks rather than types
float_timeA float that represents a durationRenders as hours and minutes rather than a scaled decimal

Reach for percentage first if the value really is a percentage and you want the percent sign rendered for you. Reach for float_factor when the multiplier is not 100, or when you want the plain number with no unit decoration. Reach for a stored computed field instead of either when the scaled value needs to be searchable, groupable or reportable, because a widget only changes the display and reports read the stored value.

Frequently asked questions

How do I show a decimal as a percentage in Odoo?+
Use widget="float_factor" with options="{'factor': 100}". A stored 0.35 shows as 35, and typing 40 stores 0.4. Use the percentage widget instead if you also want the percent sign rendered.
Does float_factor change the value stored in the database?+
No. It multiplies for display and divides the same amount back out on save, so the stored value keeps its original unit. Reports and exports read the stored value, not the scaled one.
What is the default factor?+
1. It is set in the component's defaultProps, so a float_factor field with no factor option behaves exactly like a plain float field.
Can I use digits with float_factor?+
Yes. The descriptor spreads the standard float descriptor, so every float option including digits applies. Be aware that digits rounds the displayed, scaled value and not what is stored.

Numbers that read differently in Odoo than in your reports?

Display widgets scale what people see, never what reporting reads, and that gap is where month-end arguments start. We make the stored model match how your team actually talks about the number, so the form, the export and the dashboard agree.

Book a free consultation

How this page was produced

Verified by reading addons/web/static/src/views/fields/float_factor/float_factor_field.js on the 19.0 branch of a local clone of the official Odoo repository, including the parse override and the value getter quoted above, then diffing the registration against the 20.0 branch. The default of 1 is read from static defaultProps. The usage count comes from scanning every XML file in Community, Enterprise and odoo/addons/base for widget="float_factor". Corrections welcome via our contact page.