Setup and Best Practices
First, Odoo purchase lead times drive your stock availability, cash flow, and supplier relationships. Next, this tutorial shows how to configure vendor lead time, safety buffer days, and reorder rules in Odoo 18. Then, you will see step-by-step UI instructions. Moreover, you will explore Python code to automate dynamic lead times. Finally, you will learn reporting tips and best practices to master purchase lead times in Odoo.
Odoo Purchase Lead Times Explained
First, you need to understand key lead-time concepts. Next, you will grasp how Odoo uses vendor and safety lead times to trigger purchase orders at the right moment. Then, you will avoid stockouts and overstock situations by fine-tuning these settings.
Vendor Lead Time (Delivery Wait)
Next, define vendor lead time as the calendar days from purchase-order confirmation to supplier delivery. Moreover, Odoo calls this “Delivery Lead Time.” However, you keep your inventory healthy by setting realistic vendor lead times based on past performance.
- Example: If your supplier ships in 7 days on average, set vendor lead time = 7.
- Tip: First, analyze last 6 months of deliveries before you decide.
Safety Lead Time (Buffer Days)
Then, add safety lead time to absorb unexpected delays. Moreover, Odoo labels this “Safety Lead Time.” Consequently, your reordering rule triggers earlier to prevent stockouts during supplier hiccups or transit issues.
- Example: If you worry about holiday delays, set safety lead time = 3 days.
- Tip: First, check your supplier’s historical variance before you pick buffer days.
Reorder Point and Replenishment Rules
After that, you define the reorder point that triggers new purchase orders. Next, set a minimum quantity below which Odoo creates a RFQ or PO. Then, choose your order quantity or let Odoo calculate based on demand or fixed lots.
- Rule: Reorder Point = (Daily Demand × (Vendor Lead Time + Safety Lead Time))
- Step: Adjust daily demand = average sales per day over a period.
Configuring Lead Times in Odoo
First, you will navigate Odoo’s UI to activate and set lead times. Next, follow these steps exactly.
Enable Lead Time Settings
- Go to Purchase → Configuration → Settings.
- Then, scroll to Lead Times section.
- Next, check Vendor Lead Time and Safety Lead Time.
- Finally, click Save.
Set Vendor Lead Time
- Navigate to Purchase → Products → Products.
- Next, open your product record.
- Then, click the Purchase tab.
- Afterward, set Vendor Lead Time (days) to your supplier’s average transit time.
- Finally, Save your product.
Define Safety Lead Time
- Within the same Purchase tab, find Safety Lead Time.
- Next, enter buffer days based on your risk appetite.
- Then, click Save again.
- Moreover, repeat for all high-risk items.
Create Reordering Rules
- Go to Inventory → Products → Reordering Rules.
- Then, click Create.
- Next, select your Product, Minimum Quantity, and Maximum Quantity.
- After, under Procurement, choose Create Purchase Order.
- Finally, click Save.
Automating Lead Time Calculations
First, you can automate dynamic lead-time adjustments based on delivery performance. Next, you will see Python code for a custom module.
Custom Module Structure
```text
custom_lead_time/
├── __init__.py
├── __manifest__.py
└── models/
└── purchase_lead_time.py
- manifest.py declares your module name, version, and dependencies (
purchase,stock). - purchase_lead_time.py contains the logic to recalculate lead times.
manifest.py Example
{
'name': 'Dynamic Purchase Lead Times',
'version': '1.0',
'depends': ['purchase', 'stock'],
'author': 'Your Company',
'license': 'LGPL-3',
}
Python Code to Adjust Lead Times
from odoo import api, models, fields
import statistics
class PurchaseLeadTime(models.Model):
_inherit = 'purchase.order'
def compute_dynamic_lead_time(self):
for order in self:
vendor = order.partner_id
# Gather past confirmed orders
past_orders = self.env['purchase.order'].search([
('partner_id', '=', vendor.id),
('state', '=', 'done')
])
lead_times = []
for po in past_orders:
if po.date_approve and po.date_order:
delta = (po.date_planned - po.date_order).days
lead_times.append(delta)
if lead_times:
avg_lead = int(statistics.mean(lead_times))
# Update vendor lead time on product
for line in order.order_line:
line.product_id.write({'seller_ids': [(1, line.product_id.seller_ids[0].id, {'delay': avg_lead})]})
return True
First, this method calculates the average delivery delay. Next, it updates each product’s vendor delay field. Then, you can call it after PO confirmation via a server action or scheduled cron.
XML Setup for Default Lead Time
First, add default lead-time values at installation with an XML data file.
<odoo>
<record id="product_supplierinfo_lead_time" model="product.supplierinfo">
<field name="delay">7</field>
<field name="min_qty">0</field>
<field name="product_tmpl_id" ref="product.product_template_1"/>
<field name="name" ref="base.res_partner_1"/>
</record>
</odoo>
Then, include this file in your module’s manifest under data: so Odoo loads it on install.
Monitoring and Reporting Lead Times
First, you need to track actual vs. planned lead times. Next, use Odoo’s built-in reports and dashboards.
Lead Time Dashboard
- Go to Purchase → Reporting → Purchase Analysis.
- Then, group by Vendor and Order Date.
- Next, add a custom measure: Lead Time =
date_planned - date_order. - Finally, save your view for quick access.
Analyze Delivery Performance
After that, export your PO data to Excel or CSV. Then, calculate variance and on-time rates. Moreover, share your findings monthly with procurement teams.
Best Practices for Purchase Lead Times
First, review your lead-time settings quarterly. Next, adjust buffer days seasonally. Then, audit vendor performance and renegotiate SLAs. Moreover, document all changes in your internal wiki.
Quarterly Review
- Schedule a meeting every quarter.
- Then, review average delivery times per vendor.
- Next, update your Safety Lead Time accordingly.
- Finally, communicate changes to stakeholders.
Seasonal Adjustments
First, anticipate peak-season delays. Next, increase safety buffer before holidays. Moreover, decrease buffer in stable months to free up cash.
Troubleshooting Common Issues
First, check that your user has “Purchase Manager” rights. Next, clear the cache and reload if settings do not appear. Then, upgrade your custom module if XML defaults fail. Moreover, inspect log files at /var/log/odoo/odoo-server.log for errors.
Additional Resources
- Official Odoo Purchase Docs:
https://www.odoo.com/documentation/18.0/applications/inventory/purchase.html - Community Forum:
https://www.odoo.com/forum/help-1
Conclusion
First, you mastered Odoo purchase lead times by learning vendor delay and buffer settings. Next, you configured UI and automated dynamic updates. Then, you monitored performance and applied best practices. Finally, you can maintain optimum stock levels, minimize cash tie-up, and boost supplier reliability.
Happy purchasing!
Discover more from teguhteja.id
Subscribe to get the latest posts sent to your email.

