# Fixed Asset Import Tools This folder contains scripts to manage the import and lifecycle of fixed assets in Odoo 17. ## 1. Import Script (`import_fixed_assets.py`) Imports assets from an Excel file, handling depreciation calculation and creating the assets in "Running" state to avoid opening balance duplication. ### Features - **Avoids Double Posting**: Sets assets to 'Running' manually. - **Asset Code**: Maps Column B ("Kode Barang") to `asset_code`. - **Historical Cleanup**: Deletes draft moves `<= Cutoff Date` to keep the books clean. - **Auto-Model**: Creates missing asset models (e.g. "PERALATAN DAPUR") on the fly. ### Usage Run the script providing the path to `odoo-bin`, `odoo.conf`, the Excel file, and the database name: ```bash /path/to/venv/bin/python scripts/import_fixed_assets.py \ \ \ \ ``` **Example:** ```bash /home/suherdy/Pythoncode/odoo17/.venv/bin/python scripts/import_fixed_assets.py \ /home/suherdy/Pythoncode/odoo17/odoo/odoo-bin \ /home/suherdy/Pythoncode/odoo17/odoo.conf \ "/home/suherdy/Pythoncode/odoo17/Fixed Asset Kipas.xlsx" \ kipasdbclone5 ``` --- ## 2. Post Depreciation (`post_depreciation.py`) Posts all **Draft** depreciation entries found in the system up to a specific date (default: today). This is useful to "catch up" depreciation for Nov/Dec 2025 after import. ### Usage ```bash /path/to/venv/bin/python scripts/post_depreciation.py \ \ \ \ [--date YYYY-MM-DD] ``` **Example:** ```bash /home/suherdy/Pythoncode/odoo17/.venv/bin/python scripts/post_depreciation.py \ /home/suherdy/Pythoncode/odoo17/odoo/odoo-bin \ /home/suherdy/Pythoncode/odoo17/odoo.conf \ kipasdbclone5 \ --date 2026-01-21 ``` --- ## 3. Delete All Assets (`delete_all_assets.py`) **⚠ WARNING**: This script deletes **ALL** fixed assets and their related journal entries (posted or draft). Use this only if you need to wipe clean and re-import. ### Usage Run the script providing the path to `odoo-bin`, `odoo.conf`, and the database name: ```bash /path/to/venv/bin/python scripts/delete_all_assets.py \ \ \ ``` **Example:** ```bash /home/suherdy/Pythoncode/odoo17/.venv/bin/python scripts/delete_all_assets.py \ /home/suherdy/Pythoncode/odoo17/odoo/odoo-bin \ /home/suherdy/Pythoncode/odoo17/odoo.conf \ kipasdbclone5 ``` ## Requirements 1. **Modules**: The `asset_code_field` custom module (in `customaddons/`) must be installed. 2. **Python Packages**: `openpyxl`, `python-dateutil`.