# Chart of Accounts Hierarchy - Odoo 18

## Description
This module provides hierarchical chart of accounts with parent-child relationships for Odoo 18, 
including a complete Chart of Accounts report compatible with the new Odoo 18 reporting framework.

## Features
- ✅ Hierarchical chart of accounts with parent-child relationships
- ✅ Automatic account code generation
- ✅ View accounts support (parent accounts only)
- ✅ Fixed tree length support
- ✅ Customizable account code padding
- ✅ Integration with journal creation
- ✅ **Chart of Accounts Report** with Odoo 18 compatibility

## Migration from Odoo 14
This module has been fully migrated from Odoo 14 with the following major changes:

### Account Models:
- ❌ Removed `internal_type` field
- ✅ Added `is_view_account` boolean field
- ❌ Removed `user_type_id` (Many2one)
- ✅ Now using `account_type` (Selection field)
- ✅ Updated all domain filters

### Report Framework:
- ❌ Old: `AbstractModel` with `_name = 'account.coa.report'`
- ✅ New: `AbstractModel` inheriting from `account.report`
- ❌ Old: Simple `_get_lines()` method
- ✅ New: Advanced reporting with options, filters, and hierarchies
- ✅ Compatible with Odoo 18 `account_reports` module

## Installation
1. Make sure `account_reports` module is installed (Odoo Enterprise)
2. Copy this module to your Odoo addons directory
3. Update the apps list: `Settings → Apps → Update Apps List`
4. Install from Apps menu: Search "Chart of Accounts Hierarchy"

## Configuration
Navigate to: **Accounting → Configuration → Settings → Chart of Accounts Hierarchy Settings**

Available options:
- **Automatically Generate Account Codes**: Enable auto-generation based on parent
- **Use Fixed Length**: Enforce a specific tree depth
- **Account Code Padding**: Number of digits for padding
- **Bank/Cash Prefixes**: Define account code prefixes

## Usage

### Creating Hierarchical Accounts
1. Go to: **Accounting → Configuration → Chart of Accounts**
2. Create a parent account:
   - Check "Is View Account"
   - Set the account code (e.g., `1000`)
3. Create child accounts:
   - Select the parent account in "Parent Account" field
   - Code will be generated automatically (e.g., `10001`, `10002`)

### Viewing Reports
1. Go to: **Accounting → Reporting → Chart of Accounts**
2. Use filters to customize the view:
   - Date range
   - Journals
   - Comparison periods
   - Hierarchy view

## Technical Details

### New Fields in account.account:
- `parent_id`: Many2one to parent account
- `is_view_account`: Boolean for view accounts
- `level`: Integer showing hierarchy depth
- `auto_code`: Computed account code
- `child_ids`: One2many to child accounts
- `parent_path`: Hierarchical path (using `_parent_store`)

### Dependencies:
- `account` (Odoo Community)
- `account_reports` (Odoo Enterprise - required for reports)

## Troubleshooting

### Issue: Report not showing
**Solution**: Make sure `account_reports` module is installed

### Issue: Account codes not generating
**Solution**: Enable "Automatically Generate Account Codes" in settings

### Issue: Cannot create view accounts
**Solution**: Check "Is View Account" when creating parent accounts

## Support
For issues or questions, please contact your Odoo partner or open an issue on GitHub.

## Author
Your Company

## License
LGPL-3

## Version History
- **18.0.1.0.0**: Initial migration from Odoo 14 to Odoo 18
  - Complete rewrite of account models
  - New reporting framework implementation
  - Full compatibility with Odoo 18 accounting
