Delete Expired Cost Prices
Remove product cost prices that have passed their expiration date
Overview
This task deletes product cost prices that have expired beyond a configured threshold. It helps maintain system performance and reduces storage by removing historical cost price data that is no longer needed for inventory valuation or reporting.
Identifier
| Property | Value |
|---|---|
| Implementation Type | DeleteExpiredCostPricesScheduledTask |
| Group | Prices |
| Type | Delta |
When to Use
Enable this task when you need:
- Cleanup of historical supplier cost data
- Maintenance of cost price index performance
- Reduction of storage costs
- Compliance with data retention policies
Configuration Properties
This task requires configuration in tenant settings:
| Setting | Location | Description |
|---|---|---|
deleteExpiredCostPricesThreshold | productSettings.deleteExpiredCostPricesThreshold | Number of days after expiration before cost prices are deleted |
The task will fail if this setting is not configured.
Behavior
What It Does
- Reads the
deleteExpiredCostPricesThresholdfrom tenant settings - Calculates the cutoff date (current date minus threshold days)
- Deletes all cost prices that expired before the cutoff date
- Reports the number of cost prices deleted
Prerequisites
productSettings.deleteExpiredCostPricesThresholdmust be configured in tenant settings- Product cost price service must be operational
Side Effects
- Permanently removes expired cost price records
- Reduces cost price index size
- Historical cost price data beyond threshold will not be available for reporting
Example Configuration
First, ensure tenant settings include the threshold:
Then configure the scheduled task:
Recommended Schedule
Run weekly during off-peak hours (0 4 * * 0 - 4 AM Sunday). Cost price deletion can be a heavy operation, so running it during low-traffic periods is recommended.
Related Tasks
- Delete Expired Prices - Clean up expired sales prices
