Refactor invoice financials to change iva_factor type from string to numeric

- 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.
This commit is contained in:
2026-03-23 09:48:33 -05:00
parent ebd555363f
commit fbb24f2cd3
7 changed files with 225 additions and 51 deletions

View File

@@ -517,9 +517,9 @@ class InvoiceFinancials(Base, TenantScopedMixin, TimestampMixin):
iva_mc: Mapped[Optional[float]] = mapped_column(
Numeric(23, 8), default=0, server_default="0"
) # IVAEXPOMC / IVA en MC
iva_factor: Mapped[Optional[str]] = mapped_column(
String(10)
) # FACTORIVA / Factor IVA (puede ser varchar en imports)
iva_factor: Mapped[Optional[float]] = mapped_column(
Numeric(23, 8), default=0, server_default="0"
) # FACTORIVA / Factor IVA
tax_value_me: Mapped[Optional[float]] = mapped_column(
Numeric(23, 8), default=0, server_default="0"
) # VALORIMPUESTOME / Valor impuesto ME