feat: implement package and payment method dialogs with API integration

This commit is contained in:
2026-02-16 11:52:34 -06:00
parent 5ca98ad0bc
commit 9e37340dd5
13 changed files with 674 additions and 33 deletions

View File

@@ -211,18 +211,18 @@ def validate_create(
# Calcular peso neto en kilogramos (estándar interno)
if unit_is_kgs:
if invoice_weight_type == "kgs":
if invoice_weight_type == "KGS":
line.quantity.net_weight = quantity
else: # invoice en libras
line.quantity.net_weight = quantity * Decimal("2.204624")
elif unit_is_lbs:
if invoice_weight_type == "kgs":
if invoice_weight_type == "KGS":
line.quantity.net_weight = quantity / Decimal("2.204624")
else: # invoice en libras
line.quantity.net_weight = quantity
else:
# Otra unidad de medida - usar peso capturado y convertir si es necesario
if invoice_weight_type == "kgs":
if invoice_weight_type == "KGS":
# El peso capturado está en kilos
line.quantity.net_weight = net_weight_input
else:
@@ -252,7 +252,7 @@ def validate_create(
# Si no se proporcionó peso bruto, calcularlo
if not gross_weight_input or gross_weight_input == 0:
if invoice_weight_type == "kgs":
if invoice_weight_type == "KGS":
line.quantity.gross_weight = line.quantity.net_weight + (
package_weight_unit * package_quantity
)
@@ -262,7 +262,7 @@ def validate_create(
)
else:
# Convertir peso bruto capturado según tipo de factura
if invoice_weight_type == "kgs":
if invoice_weight_type == "KGS":
line.quantity.gross_weight = gross_weight_input
else: # libras
line.quantity.gross_weight = gross_weight_input / Decimal("2.204624")

View File

@@ -73,7 +73,7 @@ def validate_update(
# Se proporcionó nuevo peso neto, convertir según tipo
net_weight_input = line.quantity.net_weight
if invoice_weight_type == "kgs":
if invoice_weight_type == "KGS":
line.quantity.net_weight = net_weight_input
else: # libras, convertir a kilos
line.quantity.net_weight = net_weight_input / Decimal("2.204624")
@@ -85,7 +85,7 @@ def validate_update(
if line.quantity.gross_weight is not None:
gross_weight_input = line.quantity.gross_weight
if invoice_weight_type == "kgs":
if invoice_weight_type == "KGS":
line.quantity.gross_weight = gross_weight_input
else: # libras, convertir a kilos
line.quantity.gross_weight = gross_weight_input / Decimal("2.204624")
@@ -98,8 +98,8 @@ def validate_update(
line.quantity.package_quantity = existing_line.quantity.package_quantity
# Clave de bultos
if not line.quantity.package_key:
line.quantity.package_key = existing_line.quantity.package_key
if not line.quantity.package_id:
line.quantity.package_id = existing_line.quantity.package_id
# País de origen
if not line.customs.origin_country: