odoo_utility_scripts/README_IMPORT.md
2026-01-21 17:03:32 +07:00

32 lines
1.5 KiB
Markdown

# Fixed Asset Import Script
This script imports fixed assets from `Fixed Asset Kipas.xlsx` into Odoo 17 database `kipasdbclone5`.
## Features
- **Avoids Double Posting**: Sets assets to 'Running' (Open) state manually, bypassing the Journal Entry creation for Asset Recognition.
- **Depreciation Calculation**: Adjusts the "Accumulated Depreciation Per Dec 31" from Excel to "Per Oct 31" (Opening Balance Date) by subtracting 2 months of depreciation.
- **Model Handling**: Automatically maps categories. Creates `Peralatan Dapur` model if missing (copying from `Peralatan Inventaris`).
- **Cutoff Date**: Skips assets acquired after Oct 31, 2025.
## Usage
Run the script using the Odoo virtual environment:
```bash
/home/suherdy/Pythoncode/odoo17/.venv/bin/python /home/suherdy/Pythoncode/odoo17/scripts/import_fixed_assets.py
```
## Logic Details
1. **Accumulated Depreciation**:
- Uses Excel column R (Accum Depr Dec 31).
- `Accum Oct 31 = Accum Dec 31 - (2 * Monthly Depreciation)`.
- If asset is fully depreciated (End Date <= Oct 31), uses `Accum Dec 31` as is.
2. **State**:
- Assets are created in `draft`.
- `compute_depreciation_board()` is called to generate Draft moves for future depreciation (subtracted by imported amount).
- `state` is manually Set to `open`.
- Result: No historical moves posted. Future moves are Draft (to be posted by cron/user). No Asset Recognition entry.
## Prerequisites
- `openpyxl`
- `python-dateutil`
- Odoo configuration file at `../odoo.conf`