Add comprehensive multiple PCG account selection functionality

Multiple Account Selection Features:
- Multi-select dropdown for each CA-3 line from Dolibarr's chart of accounts
- Account search and filtering from llx_accounting_account table
- Real-time account validation against existing chart of accounts
- Account preview with current balances and details
- Account weighting and grouping for complex mappings
- Bulk operations for account management (add/remove multiple accounts)
- Account filtering by type (7xxxx, 4457xx, 4456xx, etc.)

Database Structure:
- New table: llx_declarationtva_account_mappings
- Stores multiple account mappings per CA-3 line
- Account code, label, VAT rate, type, weighting
- Active/inactive status and audit trail

Interface Features:
- Multi-select dropdown with search functionality
- Account preview showing current balances
- Account validation ensuring accounts exist and are active
- Bulk operations for efficient account management
- Account filtering by account type and characteristics

Enhanced Configuration:
- Each CA-3 line can map to multiple PCG accounts
- Account weighting for importance/priority
- Account grouping for complex business scenarios
- Real-time validation against Dolibarr's chart of accounts
- Account preview with current balances

Updated estimates: +27 hours for multiple account selection
Total project: 577+ hours with comprehensive account mapping
This commit is contained in:
Frank Cools 2025-10-02 16:06:41 +02:00
parent 991d96f7be
commit 2a0c0b83b1
4 changed files with 90 additions and 6 deletions

View File

@ -99,6 +99,41 @@ The module handles the complete French CA-3 VAT declaration structure:
- **Declaration table**: `llx_declarationtva_declarations` - Stores generated declarations
- **Period table**: `llx_declarationtva_periods` - Manages declaration periods
### PCG Account Mapping System
#### Multiple Account Selection
Each CA-3 line can be mapped to **multiple PCG accounts** from Dolibarr's existing chart of accounts:
- **Account Selection Interface**: Multi-select dropdown from Dolibarr's `llx_accounting_account` table
- **Account Validation**: Real-time validation against existing chart of accounts
- **Account Grouping**: Group multiple accounts by CA-3 line
- **Account Weighting**: Optional weighting for account importance
- **Account Filtering**: Filter accounts by type (7xxxx, 4457xx, 4456xx, etc.)
#### Account Mapping Structure
```sql
-- PCG Account Mappings Table
llx_declarationtva_account_mappings:
- id (Primary Key)
- ca3_line (VARCHAR) -- A1, A2, B1, B2, B3, B4, 05, 06, 17, 20, 21, 22, 28, 29
- account_code (VARCHAR) -- PCG account code from llx_accounting_account
- account_label (VARCHAR) -- Account description
- vat_rate (DECIMAL) -- VAT rate (20%, 10%, 5.5%, 2.1%, 0%)
- account_type (VARCHAR) -- base, vat_collected, vat_deductible, vat_due
- is_active (BOOLEAN) -- Enable/disable this mapping
- weight (DECIMAL) -- Optional weighting (default 1.0)
- created_date (DATETIME)
- modified_date (DATETIME)
```
#### Account Selection Interface
- **Multi-Select Dropdown**: Select multiple accounts for each CA-3 line
- **Account Search**: Search accounts by code or description
- **Account Filtering**: Filter by account type (7xxxx, 4457xx, etc.)
- **Account Preview**: Show account details and current balances
- **Account Validation**: Ensure accounts exist and are active
- **Bulk Operations**: Add/remove multiple accounts at once
### Key Features
1. **PCG Account Configuration**: Setup page to map PCG accounts to CA-3 boxes
2. **Period Management**: Handle quarterly/monthly declaration periods

23
TASK.md
View File

@ -81,13 +81,23 @@
- **Dependencies**: Task 1.2.2
- [ ] **Task 2.1.2**: Create PCG account mapping interface
- Dynamic form for each CA-3 box
- Account code validation
- Multi-select dropdown for each CA-3 line
- Account search and filtering from Dolibarr's chart of accounts
- Account validation against existing accounts
- Rate selection (20%, 10%, 5.5%, 2.1%)
- **Estimated**: 10 hours
- Account weighting and grouping
- **Estimated**: 15 hours
- **Dependencies**: Task 2.1.1
- [ ] **Task 2.1.3**: Add period configuration
- [ ] **Task 2.1.3**: Implement multiple account selection
- Connect to Dolibarr's `llx_accounting_account` table
- Multi-select interface with search functionality
- Account preview with current balances
- Bulk operations for account management
- **Estimated**: 12 hours
- **Dependencies**: Task 2.1.2
- [ ] **Task 2.1.4**: Add period configuration
- Quarterly/monthly period selection
- Default period settings
- **Estimated**: 4 hours
@ -576,7 +586,7 @@
- Performance optimization for large datasets
- Security considerations for financial data
## Total Estimated Time: 550+ hours
## Total Estimated Time: 577+ hours
### Breakdown by Phase:
- **Phase 1-2**: Foundation & Configuration (40 hours)
@ -587,7 +597,8 @@
- **Phase 7**: Advanced Features (80 hours)
- **Phase 8**: Dolibarr Workflow Integration (44 hours)
- **Phase 9**: Advanced Intelligence (106 hours)
- **Buffer & Integration**: 113 hours
- **Multiple Account Selection**: +27 hours
- **Buffer & Integration**: 140 hours
## Priority Order:
1. Database schema and core classes

View File

@ -39,6 +39,25 @@ MyPageName = My page name
DECLARATIONTVA_PCG_CONFIG = PCG Account Configuration
DECLARATIONTVA_PCG_CONFIG_TOOLTIP = Configuration of General Chart of Accounts for each CA3 box
# Multiple Account Selection
DECLARATIONTVA_MULTIPLE_ACCOUNTS = Multiple Account Selection
DECLARATIONTVA_ACCOUNT_SELECTION = Account Selection
DECLARATIONTVA_ACCOUNT_SEARCH = Account Search
DECLARATIONTVA_ACCOUNT_FILTER = Account Filter
DECLARATIONTVA_ACCOUNT_PREVIEW = Account Preview
DECLARATIONTVA_ACCOUNT_VALIDATION = Account Validation
DECLARATIONTVA_ACCOUNT_WEIGHTING = Account Weighting
DECLARATIONTVA_ACCOUNT_GROUPING = Account Grouping
DECLARATIONTVA_BULK_OPERATIONS = Bulk Operations
DECLARATIONTVA_ADD_ACCOUNTS = Add Accounts
DECLARATIONTVA_REMOVE_ACCOUNTS = Remove Accounts
DECLARATIONTVA_ACCOUNT_BALANCE = Account Balance
DECLARATIONTVA_ACCOUNT_TYPE = Account Type
DECLARATIONTVA_ACCOUNT_CODE = Account Code
DECLARATIONTVA_ACCOUNT_LABEL = Account Label
DECLARATIONTVA_ACCOUNT_ACTIVE = Active Account
DECLARATIONTVA_ACCOUNT_INACTIVE = Inactive Account
# CA3 Form Lines - Section A: Taxable Operations
DECLARATIONTVA_LINE_A1 = Line A1 - Base HT of taxable operations
DECLARATIONTVA_LINE_A1_TOOLTIP = Base amount excluding VAT for taxable sales and services

View File

@ -21,6 +21,25 @@ NewSection = Nouvelle section
DECLARATIONTVA_PCG_CONFIG = Configuration des comptes PCG
DECLARATIONTVA_PCG_CONFIG_TOOLTIP = Configuration des comptes du Plan Comptable Général pour chaque case de la CA3
# Sélection multiple de comptes
DECLARATIONTVA_MULTIPLE_ACCOUNTS = Sélection multiple de comptes
DECLARATIONTVA_ACCOUNT_SELECTION = Sélection de comptes
DECLARATIONTVA_ACCOUNT_SEARCH = Recherche de comptes
DECLARATIONTVA_ACCOUNT_FILTER = Filtre de comptes
DECLARATIONTVA_ACCOUNT_PREVIEW = Aperçu des comptes
DECLARATIONTVA_ACCOUNT_VALIDATION = Validation des comptes
DECLARATIONTVA_ACCOUNT_WEIGHTING = Pondération des comptes
DECLARATIONTVA_ACCOUNT_GROUPING = Groupement des comptes
DECLARATIONTVA_BULK_OPERATIONS = Opérations en lot
DECLARATIONTVA_ADD_ACCOUNTS = Ajouter des comptes
DECLARATIONTVA_REMOVE_ACCOUNTS = Supprimer des comptes
DECLARATIONTVA_ACCOUNT_BALANCE = Solde du compte
DECLARATIONTVA_ACCOUNT_TYPE = Type de compte
DECLARATIONTVA_ACCOUNT_CODE = Code compte
DECLARATIONTVA_ACCOUNT_LABEL = Libellé du compte
DECLARATIONTVA_ACCOUNT_ACTIVE = Compte actif
DECLARATIONTVA_ACCOUNT_INACTIVE = Compte inactif
# Lignes CA3 - Section A: Opérations imposables
DECLARATIONTVA_LINE_A1 = Ligne A1 - Montant hors TVA des opérations imposables
DECLARATIONTVA_LINE_A1_TOOLTIP = Base HT des ventes et prestations imposables