1.5 KiB
1.5 KiB
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 Dapurmodel if missing (copying fromPeralatan Inventaris). - Cutoff Date: Skips assets acquired after Oct 31, 2025.
Usage
Run the script using the Odoo virtual environment:
/home/suherdy/Pythoncode/odoo17/.venv/bin/python /home/suherdy/Pythoncode/odoo17/scripts/import_fixed_assets.py
Logic Details
- 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 31as is.
- State:
- Assets are created in
draft. compute_depreciation_board()is called to generate Draft moves for future depreciation (subtracted by imported amount).stateis manually Set toopen.- Result: No historical moves posted. Future moves are Draft (to be posted by cron/user). No Asset Recognition entry.
- Assets are created in
Prerequisites
openpyxlpython-dateutil- Odoo configuration file at
../odoo.conf