Skip to main content
iVentureTeam

nemhandel_verification_code

Six single character boxes for the code sent by SMS, with focus that moves as you type and a paste handler that fills the rest from wherever you started.

Siddharth JambukiyaSiddharth JambukiyaOdoo Techno-Functional Consultant
August 27, 2026Updated August 27, 20265 min read
Technical namenemhandel_verification_code
Field typeschar
Viewsform
Modulel10n_dk_nemhandel, Danish e-invoicing registration
Used in core1 occurrence, the Nemhandel registration wizard
VersionsOdoo 20.0, Odoo 19.0, Odoo 18.0
No-code setupNo. It writes one specific field name
Alternativeschar, integer, CopyClipboardChar

What the verification code field does

Registering for Danish e-invoicing involves a code sent by SMS, and codes like that are conventionally shown as separate boxes rather than one input. The convention exists because it makes the length obvious and lets each character be corrected without retyping the rest.

This widget implements that. Six boxes, focus that advances as you type, and backspace that steps back when the current box is already empty.

It also handles the way people actually enter codes from a phone: pasting. Rather than dropping the whole string into one box, the paste handler distributes the characters forward from wherever the paste landed.

What this means for your team

Two-step registration flows fail at the code entry step more often than anywhere else, and almost always for interface reasons: the paste does not work, the focus does not move, or a mistyped character means retyping everything. This widget removes all three.

The wider point is that a compliance flow is only as good as its worst screen. E-invoicing registration is a one-off task done under mild pressure, and the difference between a smooth code entry and an awkward one is whether it gets finished in one sitting.

Working examples

The usual usage

<field name="verification_code"
       widget="nemhandel_verification_code"/>

The field name matters: the widget writes that name literally when all six boxes are filled.

What pasting does

# paste "482913" into the third box
# fills boxes 3, 4, 5, 6 with 4, 8, 2, 9

Characters are distributed forward from where the paste landed, and any surplus is discarded.

The plain alternative

<field name="verification_code"/>

One input, no focus handling and no distributed paste.

Filling forward from where you paste

Three handlers make up the widget, and each is small.

The paste handler stops the default paste, splits the clipboard text into characters and walks forward from the box that received the paste, assigning one character to each remaining box. Anything left over is dropped, and if the paste is shorter than the remaining boxes the rest are cleared. A comment in the source names the intention: letting users copy the code straight from the SMS.

The key handler moves focus forward when a box has one character and is not the last, and backward when backspace is pressed on an already empty box that is not the first. That is the standard behavior for code inputs, and getting the empty check right is what makes correcting a mistake feel natural.

The save is the strict part. The widget joins the six values and writes the field only when the result is exactly six characters long, so a partial code never reaches the record and the server never sees something it would reject.

The field it writes is named literally rather than taken from the widget's own field, which is why this is a single-purpose widget despite the behavior being generic.

Version compatibility

VersionStatusNotes
Odoo 20.0Renamed / replacedNot released. Same widget name, but the file and its wizard move into the Danish localization module.
Odoo 19.0VerifiedVerified against the shipped source. Identical to Odoo 18.
Odoo 18.0VerifiedFirst version.
Odoo 17.0Not availableWidget does not exist.
Odoo 16.0Not availableWidget does not exist.

Upgrade note. The widget arrived in Odoo 18 and is unchanged in Odoo 19, so nothing needs attention within that range. The change to plan for is the module move described below.

What is changing in Odoo 20

Odoo 20 is expected at Odoo Experience in Brussels, 24 to 26 September 2026. The development branch is unstable and this may still change; we re-verify this page after the release.

The widget moves module. On the development branch the file and its wizard live in the Danish localization itself rather than in the separate Nemhandel module, while the registered widget name is unchanged.

View XML naming the widget keeps working provided the new module is installed, but a custom module depending on the old one purely to get this feature should depend on the localization instead.

Common problems and fixes

SymptomCause and fix
The code is not savedFewer than six boxes are filled; the widget writes only a complete code. Fill all six boxes.
Pasting fills only one boxThe paste handler was prevented from running, usually by a customization. Check for a competing paste handler on the form.
Focus does not advanceThe key handler runs on key release and needs exactly one character in the box. Check for a customization intercepting keyboard events.
The field stays empty on another modelThe written field name is hardcoded rather than taken from the widget's field. Copy the widget with your own field name.
Missing widget errorThe module providing it is not installed, or the database is on a version where it moved. Install the Danish localization or the Nemhandel module as appropriate.
Backspace jumps back too eagerlyIt moves back only when the current box is already empty. Expected; delete the character first, then press backspace again.

Verification code field vs the alternatives

WidgetBest forKey difference
nemhandel_verification_codeEntering a short verification code sent to another deviceSix boxes with advancing focus and a paste that fills forward, writing only a complete code
charAny short text valueOne input, no focus handling and no distributed paste
integerA numeric code as a numberLoses leading zeros, which codes often have
CopyClipboardCharCodes users copy rather than typeA copy affordance rather than an entry aid

A plain text field works and is what most one-off code entries use. Reach for a split input only where the code is entered under time pressure and pasted from another device, which is exactly the registration case here. If you need the same behavior elsewhere, copy the widget and change the field name it writes.

Frequently asked questions

Why six separate boxes?+
It makes the expected length obvious and lets a single character be corrected without retyping the rest. The count is fixed in the source.
What happens when I paste?+
The handler splits the pasted text and fills forward from the box you pasted into. Surplus characters are dropped, and a source comment names the intent: copying the code straight from the SMS.
Why is the field sometimes empty?+
The widget writes the record only when all six boxes together form a six character value, so a partial code never reaches the field.
Can I use it on another field?+
Not as-is. The field it writes is named literally in the source rather than taken from the widget's own field.
What changes in Odoo 20?+
The widget keeps its name but moves from the separate Nemhandel module into the Danish localization, so module dependencies need repointing.

E-invoicing registration done once, correctly

Country e-invoicing mandates come with registration flows, format rules and deadlines that differ everywhere. We implement Odoo e-invoicing per jurisdiction on versions 16 through 19.

Book a free consultation

How this page was produced

The paste distribution, the focus handling, the six character check before writing and the hardcoded field name were read from the verification code widget on the Odoo 19.0 branch, together with its source comments. Version coverage comes from the absence of the file on 16.0 and 17.0, a comparison with 18.0, and locating the moved file on the public development branch. Spotted an error? Tell us and we will correct the page.