to select ↑↓ to navigate
ERPNext

ERPNext

Open in ChatGPT
Ask ChatGPT about this page
Open in Claude
Ask Claude about this page

Postcode Autocomplete

Postcode Autocomplete

Dutch addresses follow a strict, machine-friendly format: a 4-digit + 2- letter postcode plus a house number is enough to uniquely identify any delivery point in the country. This module uses that to autofill addresses the moment those two fields are present.

How it works

Open any Address form, set country to Netherlands, and enter:

  1. Postcode (e.g. 1011 PN)
  2. Address Line 1 containing a house number (e.g. Damrak 70)

As soon as both fields have parseable values, the module queries the PDOK Locatieserver — the Dutch government's open-data geocoding service — and fills in:

  • Street (straatnaam)
  • City (plaats)
  • Latitude / Longitude if your Address form exposes them

PDOK is free, run by the Dutch government, and doesn't require an API key or registration. No usage limits for normal business volumes.

Parsing the house number

The module pulls the first run of digits out of Address Line 1:

Input House number used
Damstraat 12 12
Damstraat 12-A 12
Damstraat 12 bis 12
Herengracht 182 2e hg 182 (correctly ignores the 2e)
182 Damstraat 182 (number-first works too)

If no digit run is found, the lookup is skipped — no error, just no autofill.

When it triggers

  • On change of Postcode or Address Line 1, if country is Netherlands and both fields have parseable content.
  • Only on the Address doctype. Doesn't fire on Customer / Supplier forms directly — those reference Addresses, so editing the Address triggers the autofill.

Validation on save

A server-side validate hook also runs on Address records with country = Netherlands. It checks that the postcode is structurally valid (4 digits

  • 2 letters, ignoring spaces). Invalid postcodes throw an error so you can't save a half-finished Dutch address.

Limitations

  • Dutch addresses only. The lookup is skipped if the country isn't Netherlands.
  • Not real-time as you type. The trigger fires on field-change events (when you blur the field), not on every keystroke.
  • PDOK uptime. PDOK is a government service with high uptime, but outages happen. If the lookup fails silently, you can fill the address manually — nothing else in the form depends on the autofill.
Last updated 3 days ago
Was this helpful?
Thanks!