- Introduced `_proportional_qty` function to calculate prorated quantities based on consumed amounts.
- Implemented caching for line items and import invoice numbers to optimize database queries during discharge ledger registration.
- Enhanced `register_discharge_ledger` function to utilize cached data for improved performance and reduced N+1 query issues.
- Updated discharge detail creation to include denormalized fields for reporting, such as net and gross weights, and customs information.
- Added `company_id` to `ClientProviderAddress` and `ClientProviderPrograms` for better association.
- Updated `_process_with_discharge` to simplify invoice review by removing redundant parameters.
- Improved `pre_validators` to ensure address validation checks for existence before accessing country.
- Enhanced balance comparison logic in `compare_balances` by tracking consumed quantities.
- Modified `fill_available_balances` to reflect invoice status changes from 'UNPROCESSED' to 'PENDING'.
- Introduced `get_lines_with_balance` method in `ItemService` to fetch invoice lines with available balance.
- Added new API endpoint to retrieve import invoice lines with balance information.
- Updated frontend components to display available balances and improve user experience in invoice selection.
- Updated the invoice processing route to automatically detect and handle invoice types based on the operation_type.
- Introduced error handling for non-existent invoices, returning a 404 status when an invoice is not found.
- Added a new field 'serie_row' in the Serie model to accommodate additional data for export scenarios.
- Introduced `create_balance_entries` function to generate `BalanceMovement` entries for each line item of a processed import invoice, ensuring accurate inventory balance tracking.
- Implemented `void_balance_entries` function to cancel open ENTRY movements by inserting corresponding ENTRY_VOID movements, with safeguards against already consumed lots.
- Enhanced transaction handling to maintain data integrity during invoice processing and reverting operations.
- Introduced a new movement type 'ENTRY_VOID' to handle invoice reversals, ensuring net balance remains zero.
- Updated the FaLineItem DTOs to replace 'download' with 'discharge' for consistency.
- Implemented balance entry creation in the invoice processing and reverting workflows, enhancing inventory management.
- Adjusted progress tracking messages to reflect the new balance entry generation steps.
- Renamed the 'download' field to 'discharge' in the FaLineItem model and updated related services and schemas accordingly.
- Adjusted frontend components to reflect the new 'discharge' terminology.
- Ensured consistency in filtering and validation logic across the application to use the updated field name.