- Updated the `validate_common` function to accept an optional `existing_invoice` parameter, allowing for more robust validation when updating invoices.
- Introduced a new helper function, `_normalize_invoice_currency_value`, to standardize currency code handling.
- Adjusted currency validation logic to ensure proper handling of existing invoice data, preventing changes to currency types when associated line items exist.
- Modified the `validate_update` functions in both imports and exports to pass the `existing_invoice` parameter, ensuring consistent validation across different update scenarios.
- Updated multiple DTO classes across various modules to replace the `Config` class with `model_config = ConfigDict(from_attributes=True)`.
- This change enhances consistency in attribute handling and aligns with the latest Pydantic practices.
- Adjusted error handling in core modules to change status codes from `HTTP_422_UNPROCESSABLE_ENTITY` to `HTTP_422_UNPROCESSABLE_CONTENT` for improved clarity in validation responses.
- Updated validation logic to restrict 'IMD' document type usage unless the invoice type is 'DEF'.
- Refactored value assignment in the main processing flow to handle 'DEF' and 'MEX' invoice types with specific IVA calculations.
- Added logging for invoice processing to improve traceability and debugging.
These changes improve the accuracy of invoice validations and processing for specific document types.
- Deleted the MovementService class, which handled movement operations for temporary imports, including methods for building query clauses and calculating exchange rates.
- This removal streamlines the codebase by eliminating unused legacy code, improving maintainability and clarity in the invoice processing logic.
- Updated the `iva_factor` field in the `InvoiceFinancials` model to use a numeric type with precision and scale.
- Adjusted related frontend components and API interfaces to reflect the new numeric type for `iva_factor`.
- Enhanced Alembic migration scripts to accommodate the schema changes, ensuring proper index management and data type conversions.
These changes improve data integrity and consistency for financial calculations in invoices.
- Updated the date calculations in the DashboardService to use the `invoice_date` field instead of `created_at` for querying previous totals and monthly data.
- Changed the date variables to return only the date part, improving clarity and consistency in date handling.
These changes enhance the accuracy of invoice data retrieval in the dashboard service.
- Updated invoice processing functions to eliminate legacy fields related to returned quantities, now relying on new balance movement and discharge records.
- Adjusted various components and services to reflect changes in quantity handling, including updates to the frontend for displaying used quantities instead of returned ones.
- Improved the logic for invoice total updates and validation processes to ensure consistency with the new data structure.
These changes aim to streamline invoice management and improve data integrity across the application.
- Updated `InvoiceService` to accurately reflect the number of line items in `party_count` for invoices.
- Modified weight calculations in the create and update validators to ensure consistent handling of weight types, now using lowercase comparison for "KGS".
- Adjusted invoice data structure in the frontend to include `total_items` and refined logistics handling.
- Improved table rendering in the invoice edit component for better sticky header behavior and item visibility.
These changes aim to improve data integrity and user experience in invoice management.