Add Dolibarr workflow integration for automated VAT processing
Dolibarr Hook System Integration: - Hook into invoice validation and accounting transfer events - Automatic EU supplier detection and autoliquidation - Custom fields for VAT processing (EU flag, transaction type) - Batch processing for multiple invoices - Workflow triggers for status changes Available Hooks: - supplier_invoice_validate: Auto-detect EU suppliers - supplier_invoice_accountancy_transfer: Create VAT entries - invoice_validate: Apply EU transaction rules - invoice_accountancy_transfer: Generate accounting entries Automation Workflow: 1. User creates EU supplier invoice 2. Hook triggers on validation 3. Auto-detect EU supplier 4. Create VAT due (4452xxx) and deductible (4456xx) entries 5. Entries ready for CA-3 calculations Custom Fields: - EU Supplier Flag - VAT Treatment (autoliquidation vs normal) - Transaction Type (B2B, B2C, special cases) - OSS Threshold tracking - DEB/DES requirement flags Enhanced Features: - Automatic VAT processing - Reduced manual work for EU transactions - Seamless integration with Dolibarr workflow - Custom field management - Batch processing capabilities Updated estimates: +44 hours for workflow integration Total project: 456+ hours with full Dolibarr integration
This commit is contained in:
parent
a08cc30293
commit
1d18a82f19
49
PLANNING.md
49
PLANNING.md
@ -123,6 +123,44 @@ The module handles the complete French CA-3 VAT declaration structure:
|
||||
19. **Integration APIs**: Connect with external tax systems
|
||||
20. **Mobile Support**: Responsive design for mobile access
|
||||
|
||||
### Dolibarr Workflow Integration
|
||||
21. **Autoliquidation Automation**: Automatic EU VAT autoliquidation on invoice transfer
|
||||
22. **Hook System Integration**: Extend Dolibarr core functionality
|
||||
23. **Invoice Processing Hooks**: Intercept invoice accounting transfers
|
||||
24. **Supplier Invoice Automation**: Auto-detect EU suppliers and apply autoliquidation
|
||||
25. **Customer Invoice Automation**: Auto-apply EU transaction rules
|
||||
26. **Accounting Entry Automation**: Generate VAT entries during transfer to accounting
|
||||
27. **Workflow Triggers**: Automatic VAT processing based on invoice status
|
||||
28. **Custom Fields Integration**: Extend invoices with VAT-specific fields
|
||||
29. **Status Change Automation**: Trigger VAT processing on invoice validation
|
||||
30. **Batch Processing**: Handle multiple invoices for VAT processing
|
||||
|
||||
### Dolibarr Hook Integration
|
||||
|
||||
#### Available Hooks for VAT Automation
|
||||
- **`invoice_validate`**: Trigger when invoice is validated
|
||||
- **`invoice_accountancy_transfer`**: Trigger when invoice is transferred to accounting
|
||||
- **`supplier_invoice_validate`**: Trigger when supplier invoice is validated
|
||||
- **`supplier_invoice_accountancy_transfer`**: Trigger when supplier invoice is transferred
|
||||
- **`invoice_paid`**: Trigger when invoice is marked as paid
|
||||
- **`invoice_unpaid`**: Trigger when invoice is marked as unpaid
|
||||
- **`invoice_cancel`**: Trigger when invoice is cancelled
|
||||
|
||||
#### Automation Workflow
|
||||
1. **Invoice Creation**: User creates supplier invoice from EU supplier
|
||||
2. **Hook Trigger**: `supplier_invoice_validate` hook fires
|
||||
3. **EU Detection**: Module checks if supplier is EU-based
|
||||
4. **Autoliquidation**: Automatically creates VAT due (4452xxx) and VAT deductible (4456xx) entries
|
||||
5. **Accounting Transfer**: When transferred to accounting, entries are already created
|
||||
6. **CA-3 Integration**: Entries automatically appear in CA-3 calculations
|
||||
|
||||
#### Custom Fields for VAT Processing
|
||||
- **EU Supplier Flag**: Mark suppliers as EU-based
|
||||
- **VAT Treatment**: Specify autoliquidation vs normal VAT
|
||||
- **Transaction Type**: B2B, B2C, special cases
|
||||
- **OSS Threshold**: Track B2C sales thresholds
|
||||
- **DEB/DES Required**: Flag invoices requiring exchange declarations
|
||||
|
||||
### File Structure
|
||||
```
|
||||
declarationtva/
|
||||
@ -131,10 +169,13 @@ declarationtva/
|
||||
│ └── about.php
|
||||
├── core/
|
||||
│ ├── modules/modDeclarationTVA.class.php
|
||||
│ └── class/
|
||||
│ ├── declarationtva.class.php
|
||||
│ ├── declarationtva_config.class.php
|
||||
│ └── declarationtva_period.class.php
|
||||
│ ├── class/
|
||||
│ │ ├── declarationtva.class.php
|
||||
│ │ ├── declarationtva_config.class.php
|
||||
│ │ └── declarationtva_period.class.php
|
||||
│ └── triggers/
|
||||
│ ├── interface_99_modDeclarationTVA_DeclarationTVATrigger.class.php
|
||||
│ └── action_99_modDeclarationTVA_DeclarationTVAAction.class.php
|
||||
├── lib/
|
||||
│ └── declarationtva.lib.php
|
||||
├── langs/
|
||||
|
||||
41
TASK.md
41
TASK.md
@ -449,6 +449,42 @@
|
||||
- **Estimated**: 6 hours
|
||||
- **Dependencies**: Task 7.6.1
|
||||
|
||||
### 7.7 Dolibarr Workflow Integration
|
||||
- [ ] **Task 7.7.1**: Create Dolibarr hook system
|
||||
- File: `core/triggers/interface_99_modDeclarationTVA_DeclarationTVATrigger.class.php`
|
||||
- Implement hook interface
|
||||
- Register hooks for invoice processing
|
||||
- **Estimated**: 8 hours
|
||||
- **Dependencies**: Task 1.2.1
|
||||
|
||||
- [ ] **Task 7.7.2**: Implement autoliquidation automation
|
||||
- Hook into `supplier_invoice_validate`
|
||||
- Auto-detect EU suppliers
|
||||
- Create VAT due and deductible entries
|
||||
- **Estimated**: 12 hours
|
||||
- **Dependencies**: Task 7.7.1
|
||||
|
||||
- [ ] **Task 7.7.3**: Add EU transaction automation
|
||||
- Hook into `invoice_validate` for customer invoices
|
||||
- Auto-apply EU transaction rules
|
||||
- Handle B2B vs B2C scenarios
|
||||
- **Estimated**: 10 hours
|
||||
- **Dependencies**: Task 7.7.2
|
||||
|
||||
- [ ] **Task 7.7.4**: Create custom fields for VAT processing
|
||||
- EU supplier flag
|
||||
- VAT treatment selection
|
||||
- Transaction type classification
|
||||
- **Estimated**: 6 hours
|
||||
- **Dependencies**: Task 7.7.1
|
||||
|
||||
- [ ] **Task 7.7.5**: Implement batch processing
|
||||
- Handle multiple invoices
|
||||
- Bulk VAT processing
|
||||
- Progress tracking
|
||||
- **Estimated**: 8 hours
|
||||
- **Dependencies**: Task 7.7.3
|
||||
|
||||
## Discovered During Work
|
||||
|
||||
*Tasks discovered during development will be added here*
|
||||
@ -464,7 +500,7 @@
|
||||
- Performance optimization for large datasets
|
||||
- Security considerations for financial data
|
||||
|
||||
## Total Estimated Time: 414+ hours
|
||||
## Total Estimated Time: 456+ hours
|
||||
|
||||
### Breakdown by Phase:
|
||||
- **Phase 1-2**: Foundation & Configuration (40 hours)
|
||||
@ -473,7 +509,8 @@
|
||||
- **Phase 5**: Export & Reporting (25 hours)
|
||||
- **Phase 6**: Testing & Documentation (25 hours)
|
||||
- **Phase 7**: Advanced Features (80 hours)
|
||||
- **Buffer & Integration**: 127 hours
|
||||
- **Phase 8**: Dolibarr Workflow Integration (44 hours)
|
||||
- **Buffer & Integration**: 125 hours
|
||||
|
||||
## Priority Order:
|
||||
1. Database schema and core classes
|
||||
|
||||
@ -243,3 +243,27 @@ DeclarationTVAResponsiveDesign = Responsive Design
|
||||
DeclarationTVATouchFriendly = Touch-Friendly
|
||||
DeclarationTVAAccessibility = Accessibility
|
||||
DeclarationTVAKeyboardShortcuts = Keyboard Shortcuts
|
||||
|
||||
# Dolibarr Workflow Integration
|
||||
DeclarationTVAWorkflowIntegration = Dolibarr Workflow Integration
|
||||
DeclarationTVAAutoliquidationAutomation = Autoliquidation Automation
|
||||
DeclarationTVAHookSystem = Hook System
|
||||
DeclarationTVAInvoiceProcessingHooks = Invoice Processing Hooks
|
||||
DeclarationTVASupplierInvoiceAutomation = Supplier Invoice Automation
|
||||
DeclarationTVACustomerInvoiceAutomation = Customer Invoice Automation
|
||||
DeclarationTVAAccountingEntryAutomation = Accounting Entry Automation
|
||||
DeclarationTVAWorkflowTriggers = Workflow Triggers
|
||||
DeclarationTVACustomFieldsIntegration = Custom Fields Integration
|
||||
DeclarationTVAStatusChangeAutomation = Status Change Automation
|
||||
DeclarationTVABatchProcessing = Batch Processing
|
||||
|
||||
# Custom Fields
|
||||
DeclarationTVAEUSupplierFlag = EU Supplier Flag
|
||||
DeclarationTVAVATTreatment = VAT Treatment
|
||||
DeclarationTVATransactionType = Transaction Type
|
||||
DeclarationTVAOSSThreshold = OSS Threshold
|
||||
DeclarationTVADEBDESRequired = DEB/DES Required
|
||||
DeclarationTVAAutoliquidationFlag = Autoliquidation Flag
|
||||
DeclarationTVAB2BTransaction = B2B Transaction
|
||||
DeclarationTVAB2CTransaction = B2C Transaction
|
||||
DeclarationTVASpecialCase = Special Case
|
||||
|
||||
@ -232,3 +232,27 @@ DeclarationTVAResponsiveDesign = Design responsive
|
||||
DeclarationTVATouchFriendly = Interface tactile
|
||||
DeclarationTVAAccessibility = Accessibilité
|
||||
DeclarationTVAKeyboardShortcuts = Raccourcis clavier
|
||||
|
||||
# Intégration workflow Dolibarr
|
||||
DeclarationTVAWorkflowIntegration = Intégration workflow Dolibarr
|
||||
DeclarationTVAAutoliquidationAutomation = Automatisation autoliquidation
|
||||
DeclarationTVAHookSystem = Système de hooks
|
||||
DeclarationTVAInvoiceProcessingHooks = Hooks de traitement des factures
|
||||
DeclarationTVASupplierInvoiceAutomation = Automatisation factures fournisseurs
|
||||
DeclarationTVACustomerInvoiceAutomation = Automatisation factures clients
|
||||
DeclarationTVAAccountingEntryAutomation = Automatisation écritures comptables
|
||||
DeclarationTVAWorkflowTriggers = Déclencheurs workflow
|
||||
DeclarationTVACustomFieldsIntegration = Intégration champs personnalisés
|
||||
DeclarationTVAStatusChangeAutomation = Automatisation changement de statut
|
||||
DeclarationTVABatchProcessing = Traitement par lots
|
||||
|
||||
# Champs personnalisés
|
||||
DeclarationTVAEUSupplierFlag = Drapeau fournisseur UE
|
||||
DeclarationTVAVATTreatment = Traitement TVA
|
||||
DeclarationTVATransactionType = Type de transaction
|
||||
DeclarationTVAOSSThreshold = Seuil OSS
|
||||
DeclarationTVADEBDESRequired = DEB/DES requis
|
||||
DeclarationTVAAutoliquidationFlag = Drapeau autoliquidation
|
||||
DeclarationTVAB2BTransaction = Transaction B2B
|
||||
DeclarationTVAB2CTransaction = Transaction B2C
|
||||
DeclarationTVASpecialCase = Cas spécial
|
||||
|
||||
Loading…
Reference in New Issue
Block a user