stock_inventory_backdate/README.md

86 lines
3.1 KiB
Markdown

# Stock Inventory Backdate
## Overview
This module allows you to create backdated inventory adjustments with a specific date and time. Unlike the standard Odoo inventory adjustment, this module creates stock moves with the exact backdated datetime you specify.
## Features
- **Dedicated Backdated Adjustment Form**: Separate interface for creating backdated inventory adjustments
- **Historical Inventory Position**: View the theoretical inventory quantity at the backdated time
- **Full Datetime Support**: Specify both date and time for the adjustment
- **Proper Backdating**: All related records (stock moves, move lines, valuation layers, and account moves) are backdated correctly
- **Multi-line Support**: Adjust multiple products in a single backdated adjustment
- **Lot/Serial Number Support**: Handle products with lot/serial number tracking
- **Package & Owner Support**: Support for advanced tracking features
## Usage
### Creating a Backdated Inventory Adjustment
1. Go to **Inventory > Operations > Backdated Adjustments**
2. Click **Create**
3. Set the **Adjustment Date & Time** to the desired backdate
4. Select the **Location** where you want to adjust inventory
**Option A: Load All Products**
5. Click **Load Products** to automatically load all products with inventory at that location
- The system will calculate the theoretical quantity at the backdated time for each product
6. Adjust the **Counted Quantity** for each product as needed
7. The **Difference** column shows what will be adjusted
8. Click **Validate** to create the backdated stock moves
**Option B: Add Individual Products**
5. In the **Inventory Lines** tab, click **Add a line**
6. Select the **Product** you want to adjust
- The system will automatically calculate the **Theoretical Quantity** at the backdated time
7. Enter the **Counted Quantity**
- The **Difference** is calculated automatically
8. Add more products as needed
9. Click **Validate** to create the backdated stock moves
## Technical Details
### How It Works
1. When you validate a backdated adjustment, the module creates standard stock moves
2. After the moves are processed, it updates the dates via SQL to ensure proper backdating:
- Stock move `date` field
- Stock move line `date` field
- Stock valuation layer `create_date` field
- Account move `date` field (if real-time valuation is enabled)
### Models
- **stock.inventory.backdate**: Main model for backdated adjustments
- **stock.inventory.backdate.line**: Individual product lines in the adjustment
### Security
- Stock Users can create, read, update, and delete backdated adjustments
- Stock Managers have full access
## Version History
### Version 17.0.2.0.0
- Complete redesign with dedicated backdated adjustment form
- Proper backdating of all related records
- Historical inventory position calculation
- Support for lot/serial numbers, packages, and owners
### Version 17.0.1.1.0
- Changed fields from Date to Datetime
- Added time support to inventory adjustments
### Version 17.0.1.0.0
- Initial release
- Basic backdating functionality
## Author
Suherdy Yacob
## License
AGPL-3