generate_serials
The button that generates a run of lot or serial numbers for a move, and writes the resulting lines in one go.
August 27, 2026Updated September 7, 20264 min read
| Technical name | generate_serials |
|---|---|
| Views | form (view widget, <widget> element) |
| Module | stock, the Inventory app |
| Used in core | Stock move forms in stock |
| Versions | Odoo 20.0, Odoo 19.0, Odoo 18.0, Odoo 17.0, Odoo 16.0 |
| No-code setup | No. It is set in view XML and depends on module-specific data |
| Alternatives | import_lots, sml_x2_many, stock_move_one2many |
What the generate serials does
What this means for your team
Supported options in Odoo 19
| Option | Type | What it does |
|---|---|---|
mode | prop passed to the dialog | Either generate or import. Decides the dialog's title and which inputs are shown. |
has_tracking | field read from the move | Lot or serial. Changes the title, the parsing and whether a total received field appears. |
the keep lines checkbox | control in the dialog | When unchecked, delete commands are issued for every existing line before the new ones are added. |
lot_sequence_id | field read from the product | Read when suggesting a starting number, then advanced through the sequence. |
The starting number can come from your sequence. When the product has a lot sequence configured, the widget reads the next value from it and fills the field, which also advances that sequence.
Working examples
Writing a hundred lines without a hundred round trips
Version compatibility
| Version | Status | Notes |
|---|---|---|
| Odoo 20.0 | In development | Not released. Substantially reworked on the development branch. |
| Odoo 19.0 | Verified | Verified against the shipped source. |
| Odoo 18.0 | Verified | Same dialog and both registrations. |
| Odoo 17.0 | Verified | Same approach with older component conventions. |
| Odoo 16.0 | Verified | Same approach with older component conventions. |
Upgrade note. Present since Odoo 16 with the same two registrations in one file. The dialog has gained controls across those versions but the approach is unchanged.
What is changing in Odoo 20
Common problems and fixes
| Symptom | Cause and fix |
|---|---|
| Existing lines disappeared | The keep lines checkbox was unchecked, so delete commands were issued first. Check the box to append instead of replace. |
| The next number is not from my sequence | The product has no lot sequence configured. Set one on the product; the widget reads it before suggesting a number. |
| Field change handlers did not fire | The lines are created directly from values to bypass them. Expected, and deliberate for performance. |
| The dialog title says lots not serials | The title follows the product's tracking type. Check the product's tracking setting. |
| A decimal count is rejected | Serial tracking parses the count as an integer. Expected. Lot tracking accepts decimals. |
| The unit of measure column is missing | The dialog checks a user group before showing it. Enable units of measure in settings. |
Generate serials vs the alternatives
| Widget | Best for | Key difference |
|---|---|---|
generate_serials | Generating a run of lot or serial numbers on a stock move | Writes the resulting lines straight into the relation, bypassing field change handlers |
| import_lots | Pasting numbers from a supplier | The same dialog in import mode |
sml_x2_many | Picking from existing stock | Selects quants rather than creating numbers |
| stock_move_one2many | The move lines themselves | A relation field rather than a generator |
Frequently asked questions
Where does the first number come from?+
Why are field change handlers skipped?+
Does generating twice append or replace?+
Why does lot tracking behave differently?+
Which versions have it?+
Traceability that does not slow the warehouse down
Lot and serial tracking are only sustainable when receiving is fast. We implement Odoo Inventory tracking with the entry paths your team will actually use, on versions 16 through 19.
Book a free consultation