Configuring Automatic First-Expired, First-Out (FEFO) Allocation in Sales Invoices and Stock Issue Vouchers
When you enable Auto-assign earliest expiry date (FEFO), the system automatically allocates the product quantity on a Sales Invoice across expiry-date batches, starting with the earliest valid date, based on the balance available in each batch. You do not need to select dates manually, and the batch that expires first is issued first.
Required permissionsEdit General Settings to enable the setting.
How to accessInventory ← Inventory and Product Settings ← Product Settings ← Product Tracking section ← Auto-assign earliest expiry date (FEFO)
Table of Contents
The Setting
| Item | Value |
|---|---|
| Name in the interface | Auto-assign earliest expiry date (FEFO) |
| Location | Inventory and Product Settings ← Product Settings ← Product Tracking |
| Default | Disabled |
| Scope | Applies to the entire account (all users and warehouses) |
| Tracking types | Expiry Date, Lot Number and Expiry Date, and Lot Number (the oldest lot received is issued first) |
| Documents | Sales Invoices only |
How the System Allocates the Quantity
- It sorts the batches available in the warehouse by expiry date, nearest first, starting from the invoice date. Batches that expire on the invoice date are included. For products tracked by shipment number only, shipments are sorted from the earliest received.
- It fills the first line from the nearest batch up to the batch’s maximum balance, then creates a line for the next batch, and so on.
- Any quantity that no batch covers is placed in an additional line without a batch if the Negative Stock setting is set to Allow for all products; otherwise, only the available quantity is allocated and a message appears such as “There is not enough valid stock to cover this quantity. Available: 30 units across non-expired batches. Expired batches must be assigned manually if needed.” For products tracked by shipment number only, the message “There is not enough stock to cover this quantity. Available: 30 units.” appears. This message appears in the invoice only.
- Expired batches are never selected automatically.
| Example: 45 requested; available are a batch of 20 (nearest) and a batch of 10 | Result |
|---|---|
| Line 1 | 20 from the nearest batch |
| Line 2 | 10 from the next batch |
| Line 3 | 15 without a batch (only when negative stock is allowed for all products); you must select an expiry date for it or delete it before saving |
Where the Split Happens
| Stock Requisitions for Sales Invoices | Where the Split Happens |
|---|---|
| Disabled | In the lines of the sales invoice itself. |
| Enabled | In the lines of the stock issue requisition linked to the invoice. |
Editing Before Saving
- The resulting lines can be edited before saving: you can change the batch or the quantity, or delete a line.
- A line without a batch needs to be resolved before saving (select an expiry date or delete the line); otherwise the message “You must enter the expiry date for the quantity entered for the product” appears, followed by the product name.
- In the invoice, FEFO runs when you leave the quantity field or change the unit of measure, and it excludes quantities already taken by other lines of the same invoice. In the stock issue requisition, a line that already has a batch stays as it is.
- In the stock issue requisition, no shortage message appears: if there is no valid balance in any batch, the line stays without a batch for you to choose one before approval, and if the balance is insufficient and Negative Stock is not set to Allow for all products, only the quantity available in the batches is issued.
- For a product tracked by shipment number that has only one shipment number available, the shipment number is filled in automatically in the line when the setting is enabled.
- You can always use manual allocation by adding lines or using the Split button.
What FEFO Does Not Cover
- Quotations, sales orders, returns, and credit notes.
- Purchases and stock addition requisitions.
- Products tracked by serial number.
Frequently Asked Questions
Is FEFO enabled by default?
No.
Can it be enabled for a single warehouse?
No. The setting applies at the account level.
Does it ever select expired dates?
Never.
What happens if the available balance is not enough?
If negative stock is allowed for all products, the remaining quantity is placed on an additional line with no batch. You must select an expiry date for this line or delete it before saving. Otherwise, only the available quantity is allocated and a stock shortage message appears.
Can the suggested batches be changed?
Yes, before saving.