# Product Lot Sequence Per Product This module extends Odoo's lot and serial number generation to support unique sequences per product, aligning Odoo 18 with the behavior introduced in Odoo 19. ## Features - **Per-Product Sequence Configuration**: Define a unique sequence for lot/serial number generation for each product. - **Inventory Tab Integration**: Configure the custom sequence directly on the product form under the Inventory tab. - **Automatic Generation**: Lot/serial numbers generated during incoming receipts and manufacturing orders follow the product-specific sequence. - **Fallback Mechanism**: If no sequence is defined for a product, it falls back to the global lot/serial sequence. - **UI Enhancements**: Avoids generation of invalid "0" lot numbers in manual and wizard flows. ## Configuration 1. Navigate to **Inventory > Products**. 2. Open or create a product. 3. Go to the **Inventory** tab. 4. Set the **Custom Lot/Serial** prefix to define a new sequence or select an existing sequence from the **Lot Sequence** field. 5. The **Next Number** field displays the next lot/serial number that will be generated. ## Behavior - **Incoming Shipments**: When receiving products, if a product has a custom sequence, the generated lot/serial numbers will follow this sequence. - **Manufacturing Orders**: When producing products, the finished lots/serials will be generated using the product's custom sequence. - **Manual Creation**: Creating lots/serials manually or via "Generate Serials/Lots" will respect the product's sequence if configured. ## Technical Details - The module adds a `lot_sequence_id` field to `product.template` to link the sequence. - It overrides the `stock.lot` creation to use the product's sequence. - It extends `stock.move` and `stock.move.line` to handle UI inputs and normalize "0" or empty inputs. - It overrides `mrp.production._prepare_stock_lot_values` to ensure manufacturing flows use the product sequence. ## Dependencies - `stock` - `mrp` ## Compatibility - Odoo 18 - Requires `mrp` module for manufacturing order support