l10n_in_hsn_autocomplete
Type three characters and Odoo asks India's GST portal for matching HSN codes. The request goes from the user's browser, not from your server, and that has consequences worth knowing before you deploy it.
| Technical name | l10n_in_hsn_autocomplete |
|---|---|
| Field types | char, text |
| Views | form, list |
| Module | l10n_in, the Indian localization |
| Used in core | 1 occurrence, the HSN code on the product template form in l10n_in |
| Versions | Odoo 20.0, Odoo 19.0, Odoo 18.0, Odoo 17.0 |
| No-code setup | No. It ships with the Indian localization and is set in view XML |
| Alternatives | char, many2one, text |
What the HSN autocomplete does
What this means for your team
Supported options in Odoo 19
| Option | Type | What it does |
|---|---|---|
hsn_description_field | string (field name) | Technical name of a field that receives the official description when a suggestion is chosen. Declared as a string, though the value is a field name. Without it only the code is written. |
Inherited options and attributes are dead here. The descriptor spreads the text widget but then defines its own extractProps that returns only the description field name. Nothing else is extracted, so the placeholder attribute, the dynamic placeholder option and the password and autocomplete attributes all stop working on this field, with no warning. The option's declared type is also loose: it is announced as a string, and the value it takes is a technical field name.
Working examples
A browser calling a government API
Version compatibility
| Version | Status | Notes |
|---|---|---|
| Odoo 20.0 | In development | Not released. Behavior identical on the development branch; only props and reference helpers change. |
| Odoo 19.0 | Verified | Verified against the shipped source. Suggestion objects restructured, behavior unchanged. |
| Odoo 18.0 | Verified | Same option and same lookup, with a flatter suggestion shape. |
| Odoo 17.0 | Verified | First version. |
| Odoo 16.0 | Not available | Widget does not exist. |
Upgrade note. The widget and its option have been the same since Odoo 17, so views carry over. Odoo 19 changed the internal shape of the suggestion objects and dropped an unused flag from the source definition, which matters only to custom JavaScript. Note also that the field is gated on Indian fiscal settings in the core view, so an upgrade only surfaces it where the localization is active.
What is changing in Odoo 20
Common problems and fixes
| Symptom | Cause and fix |
|---|---|
| The dropdown says it could not contact the API | The request from the user's browser to the government service failed or timed out after five seconds. Check the user's network and any corporate filtering. The field still accepts typed input. |
| No suggestions appear at all | Fewer than three characters have been typed. Type at least three characters; the source only queries beyond that length. |
| A code I know exists is missing | Entries with a code of three characters or fewer are filtered out. Type more of the code, or enter the value manually. |
| The description field is not filled | The hsn_description_field option is not set. Add options="{'hsn_description_field': 'your_field'}" naming the description field. |
| The placeholder is ignored | The widget replaces the text widget's extractor, so the placeholder never reaches the input. Use a label or help text instead. |
| The field is not visible | The core view hides it unless the company's fiscal country is India and GST registration is enabled. Check the fiscal localization settings. |
| Suggestions are slow | The lookup is a live call to an external service, with a five second ceiling. Nothing to tune in Odoo; the timeout is fixed in the source. |
HSN autocomplete vs the alternatives
| Widget | Best for | Key difference |
|---|---|---|
l10n_in_hsn_autocomplete | Finding an official HSN or SAC code without leaving the product form | Queries India's GST portal live from the browser and can fill a description field alongside the code |
| char | Typing a code you already know | No lookup, but every inherited option and attribute still works |
| many2one | Choosing from a schedule imported into your own model | A real relation with server-side search, no external dependency |
| text | Longer free text | Textarea rendering, no suggestions |
Frequently asked questions
Where do the HSN suggestions come from?+
What happens if the service is unreachable?+
Why do some codes never appear?+
Can it fill the description as well?+
Why does my placeholder not show?+
GST compliance that does not depend on one person's memory
HSN classification, e-invoicing and GST returns in Odoo depend on product data being right long before the return is filed. We implement and verify the Indian localization on Odoo 16 through 19, from chart of accounts to e-invoice submission.
Book a free consultation