Refactor item validation and calculation logic
- Moved validation functions for creating and updating line items to dedicated modules. - Introduced new calculations module for handling financial calculations related to line items. - Updated import paths for validation functions to reflect new structure.
This commit is contained in:
@@ -24,8 +24,8 @@ from api.v1.modules.a76.invoices.common.common_validators import (
|
||||
invoice_updated,
|
||||
)
|
||||
from core.exceptions import ErrorCollector
|
||||
from .imports.temporary.validators.create import validate_create
|
||||
from .imports.temporary.validators.update import validate_update
|
||||
from .imports.validators.create import validate_create as validate_create_import
|
||||
from .imports.validators.update import validate_update as validate_update_import
|
||||
|
||||
from .schemas import LineItemCreate, LineItemUpdate
|
||||
from .line_financials.models import LineFinancial
|
||||
@@ -329,7 +329,7 @@ class ItemService:
|
||||
item_data.component_part_number_id = resolved_id
|
||||
|
||||
# Validar el item
|
||||
validate_create(
|
||||
validate_create_import(
|
||||
db,
|
||||
item_data, # Schema Pydantic completo
|
||||
tenant_id,
|
||||
@@ -443,7 +443,7 @@ class ItemService:
|
||||
item_data.component_part_number_id = resolved_id
|
||||
|
||||
# Validar el item que se va a actualizar
|
||||
validate_update(
|
||||
validate_update_import(
|
||||
db,
|
||||
item_data, # Schema de update
|
||||
db_item, # LineItem existente en DB
|
||||
|
||||
Reference in New Issue
Block a user